From: Jan Szejko Date: Tue, 29 Nov 2016 15:43:08 +0000 (+0100) Subject: add tags to document and organization X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/8f392c8987476f29a38fa33ab06c36471ff2cb98 add tags to document and organization --- diff --git a/apps/catalogue/migrations/0007_document_tags.py b/apps/catalogue/migrations/0007_document_tags.py new file mode 100644 index 00000000..2bc4df40 --- /dev/null +++ b/apps/catalogue/migrations/0007_document_tags.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0006_category_tag'), + ] + + operations = [ + migrations.AddField( + model_name='document', + name='tags', + field=models.ManyToManyField(to='catalogue.Tag'), + ), + ] diff --git a/apps/catalogue/models/document.py b/apps/catalogue/models/document.py index aedbb687..5fa6242e 100755 --- a/apps/catalogue/models/document.py +++ b/apps/catalogue/models/document.py @@ -13,6 +13,7 @@ from django.utils.translation import ugettext_lazy as _ from dvcs.models import Ref from organizations.models import Organization from catalogue.constants import STAGES +from .tag import Tag class Document(Ref): @@ -23,6 +24,7 @@ class Document(Ref): stage = models.CharField(_('stage'), max_length=128, blank=True, default=STAGES[0]) assigned_to = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, related_name='assignments') deleted = models.BooleanField(default=False) + tags = models.ManyToManyField(Tag) # Where to cache searchable stuff from metadata? # Probably in some kind of search index. diff --git a/apps/organizations/migrations/0008_organization_tags.py b/apps/organizations/migrations/0008_organization_tags.py new file mode 100644 index 00000000..09969d0a --- /dev/null +++ b/apps/organizations/migrations/0008_organization_tags.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0007_document_tags'), + ('organizations', '0007_auto_20160126_1148'), + ] + + operations = [ + migrations.AddField( + model_name='organization', + name='tags', + field=models.ManyToManyField(to='catalogue.Tag'), + ), + ] diff --git a/apps/organizations/models.py b/apps/organizations/models.py index 1781d7db..9d3300a2 100644 --- a/apps/organizations/models.py +++ b/apps/organizations/models.py @@ -103,16 +103,17 @@ class Organization(Card): preview_html_template = 'organizations/snippets/organization.html' name = models.CharField(max_length=1024) - #logo = models.ImageField(upload_to='people/logo', blank=True) - #country = models.CharField(max_length=64, blank=True, choices=countries) - #www = models.URLField(blank=True) - #description = models.TextField(blank=True, default="") - ##projects = JSONField(default=[]) - #projects = models.TextField(blank=True, default="") + tags = models.ManyToManyField('catalogue.Tag') + # logo = models.ImageField(upload_to='people/logo', blank=True) + # country = models.CharField(max_length=64, blank=True, choices=countries) + # www = models.URLField(blank=True) + # description = models.TextField(blank=True, default="") + # #projects = JSONField(default=[]) + # projects = models.TextField(blank=True, default="") - #preview_html = models.TextField(blank=True, default="") + # preview_html = models.TextField(blank=True, default="") - #created_at = models.DateTimeField(auto_now_add=True) + # created_at = models.DateTimeField(auto_now_add=True) def __str__(self): return self.name