From nobody Tue May 13 19:50:13 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1555604533; cv=none; d=zoho.com; s=zohoarc; b=UmAOGuuUk26/UkvnQjXP60wyDtL9BfBHzvVBQbJ8f3zJOEW3Fzg74mTZAhHulTqHXJLlDZe90MGz8Y4MGXBvbpwig8uoddqpKX9H0+4cZIvVjmKiquQaCzRv42bo9fUa8+bQPnVkVl+b3wfkIenqOlGoWxGsAb3ycTT+wFNS7Co= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555604533; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=/enxxNb+xscvwa9v33YrUSUMk+Mo43YJ5xF+s/XdHWk=; b=M8chEJ9hXj7RNgeYCCvVmyANQRILtuVi19HqbCOqcD9ZHpt6zB53yxZfpdtSnjtpexug0M/M1OrIullzOJma4o7pzPlvfsY3ud6x8lQerR9yqaajFyYRtQLWWSWQYTThbZGPMK0jJaLNoXsojxJrEBEv3MbJAYcYmo4uk2bktcI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1555604533427164.46647943553126; Thu, 18 Apr 2019 09:22:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3CD69C0270D3; Thu, 18 Apr 2019 16:22:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F8706085B; Thu, 18 Apr 2019 16:22:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CD0ED4EA71; Thu, 18 Apr 2019 16:22:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3IGMA7A009244 for ; Thu, 18 Apr 2019 12:22:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 42B6C60BFC; Thu, 18 Apr 2019 16:22:10 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-46.ams2.redhat.com [10.36.112.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 834BF60BF7 for ; Thu, 18 Apr 2019 16:22:08 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Thu, 18 Apr 2019 18:21:46 +0200 Message-Id: <20190418162146.5695-11-pbonzini@redhat.com> In-Reply-To: <20190418162146.5695-1-pbonzini@redhat.com> References: <20190418162146.5695-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 10/10] models: remove property tables X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 18 Apr 2019 16:22:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" --- api/admin.py | 14 +-------- api/migrations/0053_auto_20190418_1357.py | 37 +++++++++++++++++++++++ api/models.py | 29 +----------------- api/search.py | 2 +- mods/git.py | 3 +- mods/testing.py | 3 +- 6 files changed, 42 insertions(+), 46 deletions(-) create mode 100644 api/migrations/0053_auto_20190418_1357.py diff --git a/api/admin.py b/api/admin.py index bd9e85b..ef0e21b 100644 --- a/api/admin.py +++ b/api/admin.py @@ -9,27 +9,15 @@ # http://opensource.org/licenses/MIT. =20 from django.contrib import admin -from .models import Message, MessageProperty, Module, Project, ProjectProp= erty +from .models import Message, Module, Project from mod import get_module =20 =20 -class ProjectPropertyInline(admin.TabularInline): - model =3D ProjectProperty - extra =3D 0 - - class ProjectAdmin(admin.ModelAdmin): filter_horizontal =3D ('maintainers',) - inlines =3D [ProjectPropertyInline] - - -class MessagePropertyInline(admin.TabularInline): - model =3D MessageProperty - extra =3D 0 =20 =20 class MessageAdmin(admin.ModelAdmin): - inlines =3D [MessagePropertyInline] list_filter =3D [('is_series_head')] search_fields =3D [ 'message_id', diff --git a/api/migrations/0053_auto_20190418_1357.py b/api/migrations/005= 3_auto_20190418_1357.py new file mode 100644 index 0000000..4621bcd --- /dev/null +++ b/api/migrations/0053_auto_20190418_1357.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-04-18 13:57 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies =3D [ + ('api', '0052_populate_property_fields'), + ] + + operations =3D [ + migrations.AlterUniqueTogether( + name=3D'messageproperty', + unique_together=3Dset([]), + ), + migrations.RemoveField( + model_name=3D'messageproperty', + name=3D'message', + ), + migrations.AlterUniqueTogether( + name=3D'projectproperty', + unique_together=3Dset([]), + ), + migrations.RemoveField( + model_name=3D'projectproperty', + name=3D'project', + ), + migrations.DeleteModel( + name=3D'MessageProperty', + ), + migrations.DeleteModel( + name=3D'ProjectProperty', + ), + ] diff --git a/api/models.py b/api/models.py index 2a6c09b..62f2656 100644 --- a/api/models.py +++ b/api/models.py @@ -304,16 +304,6 @@ class ProjectResult(Result): return self.project =20 =20 -class ProjectProperty(models.Model): - project =3D models.ForeignKey('Project', on_delete=3Dmodels.CASCADE) - name =3D models.CharField(max_length=3D1024, db_index=3DTrue) - value =3D jsonfield.JSONField() - - class Meta: - unique_together =3D ('project', 'name',) - verbose_name_plural =3D "Project Properties" - - declare_event("SeriesComplete", project=3D"project object", series=3D"series instance that is marked complete") declare_event("SeriesMerged", project=3D"project object", @@ -358,7 +348,7 @@ class MessageManager(models.Manager): return None else: q =3D super(MessageManager, self).get_queryset() - return q.filter(is_series_head=3DTrue).prefetch_related('messagepr= operty_set', 'project') + return q.filter(is_series_head=3DTrue).prefetch_related('project') =20 def find_series(self, message_id, project_name=3DNone): heads =3D self.series_heads(project_name) @@ -795,23 +785,6 @@ class MessageResult(Result): return self.message =20 =20 -class MessageProperty(models.Model): - message =3D models.ForeignKey('Message', on_delete=3Dmodels.CASCADE) - name =3D models.CharField(max_length=3D256) - value =3D jsonfield.JSONField() - - def __str__(self): - if len(self.value) > 30: - val_prev =3D self.value[:30] + "..." - else: - val_prev =3D self.value - return "%s: %s =3D %s" % (self.message.subject, self.name, val_pre= v) - - class Meta: - unique_together =3D ('message', 'name',) - verbose_name_plural =3D "Message Properties" - - class Module(models.Model): """ Module information """ name =3D models.CharField(max_length=3D128, unique=3DTrue) diff --git a/api/search.py b/api/search.py index 1c5aaaf..658ad4a 100644 --- a/api/search.py +++ b/api/search.py @@ -8,7 +8,7 @@ # This work is licensed under the MIT License. Please see the LICENSE fil= e or # http://opensource.org/licenses/MIT. =20 -from .models import Message, MessageProperty, MessageResult, Result, Queue= dSeries +from .models import Message, MessageResult, Result, QueuedSeries from functools import reduce =20 from django.db import connection diff --git a/mods/git.py b/mods/git.py index 8e868c2..c1909ab 100644 --- a/mods/git.py +++ b/mods/git.py @@ -20,8 +20,7 @@ from django.utils.html import format_html from django.db.models import Q from mod import PatchewModule from event import declare_event, register_handler, emit_event -from api.models import (Message, MessageProperty, Project, - ProjectProperty, Result) +from api.models import (Message, Project, Result) from api.rest import PluginMethodField, reverse_detail from api.views import APILoginRequiredView, prepare_series from patchew.logviewer import LogView diff --git a/mods/testing.py b/mods/testing.py index e5562ba..f238406 100644 --- a/mods/testing.py +++ b/mods/testing.py @@ -19,8 +19,7 @@ import datetime import time import math from api.views import APILoginRequiredView -from api.models import (Message, MessageProperty, MessageResult, - Project, ProjectResult, Result) +from api.models import (Message, MessageResult, Project, ProjectResult, Re= sult) from api.rest import PluginMethodField, reverse_detail from api.search import SearchEngine, FLAG_TESTED from event import emit_event, declare_event, register_handler --=20 2.21.0 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel