Alexander Solovyov avatar Alexander Solovyov committed ace2aad

tag translation support added

Comments (0)

Files changed (2)

byteflow/tagging/models.py

     A tag.
     """
     name = models.CharField(_('name'), max_length=50, unique=True, db_index=True, validator_list=[isTag])
+    translation = models.CharField(_('name translation'), max_length=50, blank=True)
 
     objects = TagManager()
 
     def get_absolute_url(self):
         return reverse('post_by_tag', tag=self.name)
 
+    def get_name(self):
+        if self.translation:
+            return self.translation
+        else:
+            return self.name
+
 class TaggedItem(models.Model):
     """
     Holds the relationship between a tag and the item being tagged.
+ALTER TABLE tag ADD COLUMN translation varchar(50) NOT NULL;
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.