def backwards(self, orm): "Convert back from tech:* tags under django-taggit to django-tagging tags" for demo in orm.Submission.objects.all(): # HACK: South gets confused by taggit_tags field, so we have to conjure it up here taggit_tags = _TaggableManager(through=TaggedItem, model=orm.Submission, instance=demo) demo.tags = ' '.join( x.name.replace('tech:', '') for x in taggit_tags.all() if (x.name.startswith('tech:'))) # Could destroy the data, but why bother? # taggit_tags.clear() demo.save()
def backwards(self, orm): "Convert back from tech:* tags under django-taggit to django-tagging tags" for demo in orm.Submission.objects.all(): # HACK: South gets confused by taggit_tags field, so we have to conjure it up here taggit_tags = _TaggableManager(through=TaggedItem, model=orm.Submission, instance=demo) demo.tags = ' '.join( x.name.replace('tech:', '') for x in taggit_tags.all() if (x.name.startswith('tech:')) ) # Could destroy the data, but why bother? # taggit_tags.clear() demo.save()
def forwards(self, orm): "Convert from django-tagging tags to tech:* tags under django-taggit" for demo in orm.Submission.objects.all(): tags = parse_tags(demo.tags) # HACK: South gets confused by taggit_tags field, so we have to conjure it up here taggit_tags = _TaggableManager(through=TaggedItem, model=orm.Submission, instance=demo) taggit_tags.set(*('tech:%s' % (x) for x in tags if x in self.KNOWN_TECH_TAGS)) # Could destroy the data, but why bother? # demo.tags = '' demo.save()
def forwards(self, orm): "Convert from django-tagging tags to tech:* tags under django-taggit" for demo in orm.Submission.objects.all(): tags = parse_tags(demo.tags) # HACK: South gets confused by taggit_tags field, so we have to conjure it up here taggit_tags = _TaggableManager(through=TaggedItem, model=orm.Submission, instance=demo) taggit_tags.set(*( 'tech:%s' % ( x ) for x in tags if x in self.KNOWN_TECH_TAGS )) # Could destroy the data, but why bother? # demo.tags = '' demo.save()