0
모델의 여러 태그에 대한 좋은 해결책이나 해결책을 찾지 못했습니다.django-taggit 태그를 항상 소문자로 덮어 씁니다.
여기How can I limit django-taggit to accept only lowercase words?
내 현재 코드는 다음과 같습니다 :
def clean_tags(self):
"""
Force all tags to lowercase.
"""
tags = self.cleaned_data.get('tags', None)
if tags:
tags = [t.lower() for t in tags]
return tags
은 정말 따라 달라
from taggit.managers import TaggableManager
from taggit.models import TaggedItemBase
class TaggedStory(TaggedItemBase):
content_object = models.ForeignKey("Story")
class TaggedSEO(TaggedItemBase):
content_object = models.ForeignKey("Story")
class Story(models.Model):
...
tags = TaggableManager(through=TaggedStory, blank=True, related_name='story_tags')
...
seo_tags = TaggableManager(through=TaggedSEO, blank=True, related_name='seo_tags')
전화를 걸면 양식에서 확인하지 않은 것 같습니다. 나는 이것을 시도 할 수도있다, 나는 단지 그것을 서브 클래 싱하는 것에 대해 내 머리를 감쌀 수 없다. – John
답변으로 받아 들여야합니다! –