You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
1.0 KiB

# -*- coding: utf-8 -*-
from django.db import models
from hvad.models import TranslatableModel, TranslatedFields
from django.template.defaultfilters import slugify
class Article(TranslatableModel):
"""
Create Article model
Uses hvad.TranslatableModel which is child of django.db.models class
"""
url = models.SlugField(unique=True)
theme = models.ManyToManyField('theme.Theme')
tag = models.ManyToManyField('theme.Tag', related_name='tags',blank=True, null=True)
author = models.CharField(max_length=150, blank=True)
#translated fields
translations = TranslatedFields(
main_title = models.CharField(max_length=100),
preview = models.TextField(),
description = models.TextField(),
#-----meta
title = models.CharField(max_length=255, blank=True),
descriptions = models.CharField(max_length=255, blank=True),
keywords = models.CharField(max_length=255, blank=True),
)
def __unicode__(self):
return self.lazy_translation_getter('main_title', self.pk)