> > >> +<p>Please refer to the <a > > >> href="https://www.debian.org/doc/manuals/developers-reference/resources.html#pkg-tracking-system">developer > > >> reference</a> for a description of the subscription keywords.</a></p> > > > > > > This is not OK. This information must be available on the screen where > > > you pick the keywords for your subscription. And I'd rather avoid an > > > external reference. We should have added a description field to the > > > Keyword model... > > > > Yes, we should provide contextual help on the subscription keywords > > meaning. As we are now running Django 1.7 I will add a description field > > and adapt the fixture. (Do you recommend opening another bug or renaming > > the current one?) > > We can continue to use this bug, it's ok for me. > > Make sure that the migration(s) creates the missing field and injects the > proper default values.
Adding a Keyword description field with data works fine, please review the attached patch. The keywords modification form seems broken: here boxes do not shown checked for already active subscription keywords; do you remember it working recently? I do not get the point of making several requests using javascript in order to compose that form, see accounts/static/js/profile.js Why do not we rely on standard django form facilities? Christophe
>From 7cf70c34d9f42c6c3499445a8bdaba824be9c118 Mon Sep 17 00:00:00 2001 From: Christophe Siraut <d...@tobald.eu.org> Date: Thu, 16 Jul 2015 17:30:22 +0200 Subject: [PATCH] core/models: add a description field to Keyword --- .../accounts/templates/accounts/subscriptions.html | 6 +-- .../core/migrations/0004_keyword_description.py | 20 ++++++++++ .../core/migrations/0005_keyword_data.py | 43 ++++++++++++++++++++++ distro_tracker/core/models.py | 1 + 4 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 distro_tracker/core/migrations/0004_keyword_description.py create mode 100644 distro_tracker/core/migrations/0005_keyword_data.py diff --git a/distro_tracker/accounts/templates/accounts/subscriptions.html b/distro_tracker/accounts/templates/accounts/subscriptions.html index b5ee53a..5b2d7bd 100644 --- a/distro_tracker/accounts/templates/accounts/subscriptions.html +++ b/distro_tracker/accounts/templates/accounts/subscriptions.html @@ -60,7 +60,7 @@ <div class="default-keywords" style="display: none;" id="default-keywords-{{ forloop.counter }}"> <ul> {% for keyword in email.default_keywords.all %} - <li class="keyword">{{ keyword }}</li> + <li title="{{ keyword.description }}" class="keyword">{{ keyword }}</li> {% endfor %} </ul> </div> @@ -122,7 +122,7 @@ <div><b>Subscription keywords:</b></div> <ul class="inline"> {% for keyword in subscription.keywords.all %} - <li class='keyword'>{{ keyword }}</li> + <li title="{{ keyword.description }}" class='keyword'>{{ keyword }}</li> {% endfor %} </ul> </div> @@ -173,7 +173,7 @@ <div><b>Team-specific keywords:</b></div> <ul class="inline"> {% for keyword in membership.default_keywords.all %} - <li class='keyword'>{{ keyword }}</li> + <li title="{{ keyword.description }}" class='keyword'>{{ keyword }}</li> {% endfor %} </ul> <div class="btn btn-small modify-membership-keywords" data-email="{{ email }}" data-href="{% url 'dtracker-team-set-keywords' membership.team.slug %}">Modify</div> diff --git a/distro_tracker/core/migrations/0004_keyword_description.py b/distro_tracker/core/migrations/0004_keyword_description.py new file mode 100644 index 0000000..2e63af9 --- /dev/null +++ b/distro_tracker/core/migrations/0004_keyword_description.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0003_lxde_list_archives'), + ] + + operations = [ + migrations.AddField( + model_name='keyword', + name='description', + field=models.CharField(max_length=500, blank=True), + preserve_default=True, + ), + ] diff --git a/distro_tracker/core/migrations/0005_keyword_data.py b/distro_tracker/core/migrations/0005_keyword_data.py new file mode 100644 index 0000000..63e09b7 --- /dev/null +++ b/distro_tracker/core/migrations/0005_keyword_data.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations + + +def describe_keywords(apps, schema_editor): + Keyword = apps.get_model('core', 'Keyword') + Keyword.objects.filter(name='default').update(description=' all the other \ +mails (those which aren\'t automatic)') + Keyword.objects.filter(name='bts').update(description='mails coming from \ +the Debian Bug Tracking System') + Keyword.objects.filter(name='bts-control').update(description='reply to \ +mails sent to <cont...@bugs.debian.org>') + Keyword.objects.filter(name='summary').update(description='automatic \ +summary mails about the state of a package') + Keyword.objects.filter(name='upload-source').update(description='announce \ +of a new source upload that has been accepted') + Keyword.objects.filter(name='contact').update(description='mails sent to \ +the maintainer through the *@packages.debian.org aliases') + Keyword.objects.filter(name='build').update(description='build failures \ +notifications from build daemons') + Keyword.objects.filter(name='vcs').update(description='notification of VCS \ +commits') + Keyword.objects.filter(name='upload-binary').update(description='announce \ +of a new binary-only upload (porting)') + Keyword.objects.filter(name='derivatives').update(description='changes made \ +on the package by derivative distributions') + Keyword.objects.filter(name='derivatives-bugs').update(description='bugs \ +reports and comments from derivative distributions') + # Keyword.objects.filter(name='archive').update(description='') + # Keyword.objects.filter(name='translation').update(description='') + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0004_keyword_description'), + ] + + operations = [ + migrations.RunPython(describe_keywords), + ] diff --git a/distro_tracker/core/models.py b/distro_tracker/core/models.py index aded24e..78b0295 100644 --- a/distro_tracker/core/models.py +++ b/distro_tracker/core/models.py @@ -56,6 +56,7 @@ class Keyword(models.Model): """ name = models.CharField(max_length=50, unique=True) default = models.BooleanField(default=False) + description = models.CharField(max_length=400, blank=True) def __str__(self): return self.name -- 2.1.4