Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_queryset(self):
- locale = get_language()
- return super().get_queryset().annotate(title=F('title_' + locale), body=F('body_' + locale),
- short_description=F('short_description_' + locale),
- seo_title=F('seo_title_' + locale))
- title_uk = models.CharField(max_length=255, blank=False)
- title_en = models.CharField(max_length=255, blank=True)
- seo_title_uk = models.CharField(max_length=255, blank=True)
- seo_title_en = models.CharField(max_length=255, blank=True)
- short_description_uk = RichTextField(blank=False)
- short_description_en = RichTextField(blank=True)
- body_uk = RichTextField(blank=False)
- body_en = RichTextField(blank=True)
- created_at = models.DateTimeField(auto_now_add=True)
- published = models.BooleanField(default=False)
- objects = NewsManager()
- def get_queryset(self):
- return News.objects.all().exclude(published=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement