diff --git a/entries/migrations/0011_auto_20171120_1108.py b/entries/migrations/0011_auto_20171120_1108.py new file mode 100644 index 0000000..6e0020f --- /dev/null +++ b/entries/migrations/0011_auto_20171120_1108.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.7 on 2017-11-20 00:08 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('entries', '0010_entry_tags'), + ] + + operations = [ + migrations.RenameModel( + old_name='Tag', + new_name='Cat', + ), + migrations.RenameField( + model_name='entry', + old_name='tags', + new_name='cats', + ), + ] diff --git a/entries/models.py b/entries/models.py index 51ed872..d7c8143 100644 --- a/entries/models.py +++ b/entries/models.py @@ -17,20 +17,20 @@ from lemoncurry import requests ENTRY_KINDS = [(k.id, k.id) for k in kinds.all] -class TagManager(models.Manager): +class CatManager(models.Manager): def from_name(self, name): - tag, created = self.get_or_create(name=name, slug=slugify(name)) - return tag + cat, created = self.get_or_create(name=name, slug=slugify(name)) + return cat -class Tag(models.Model): - objects = TagManager() +class Cat(models.Model): + objects = CatManager() name = models.CharField(max_length=255, unique=True) slug = models.CharField(max_length=255, unique=True) @property def url(self): - return reverse('entries:tagged', args=(self.slug,)) + return reverse('entries:cat', args=(self.slug,)) class Meta: ordering = ('name',) @@ -55,7 +55,7 @@ class Entry(ModelMeta, TimeStampedModel): photo = models.ImageField(blank=True) content = models.TextField() - tags = models.ManyToManyField(Tag, related_name='entries') + cats = models.ManyToManyField(Cat, related_name='entries') in_reply_to = models.CharField(max_length=255, blank=True) like_of = models.CharField(max_length=255, blank=True) diff --git a/entries/templates/entries/h-entry.html b/entries/templates/entries/h-entry.html index c4c8b40..99b31da 100644 --- a/entries/templates/entries/h-entry.html +++ b/entries/templates/entries/h-entry.html @@ -41,12 +41,12 @@ {% endif %} - {% if entry.tags.exists %} + {% if entry.cats.exists %}
diff --git a/entries/urls.py b/entries/urls.py index 8e481c0..4821c1c 100644 --- a/entries/urls.py +++ b/entries/urls.py @@ -15,9 +15,9 @@ app_name = 'entries' urlpatterns = [ url('^atom$', feeds.AtomHomeEntries(), name='atom'), url('^rss$', feeds.RssHomeEntries(), name='rss'), - url('^tags/(?P