Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class News(models.Model):
- def save(self, *args, **kwargs):
- if not self.id:
- ci = ContentItem(contenttype='News', path='my/test')
- ci.save()
- self.itemid = ci.id
- super(News, self).save(*args, **kwargs)
- title = models.CharField(max_length=255)
- itemid = models.IntegerField(blank=True)
- summary = models.TextField()
- body = models.TextField()
- author = models.ManyToManyField(Author,blank=True)
- category = models.ForeignKey(Category,null=True,blank=True)
- def __unicode__(self):
- return self.title
- class Meta:
- verbose_name_plural = "news"
- class NewsForm(ModelForm):
- itemid = forms.IntegerField(widget=forms.HiddenInput,required=False)
- class Meta:
- model = News
Advertisement
Add Comment
Please, Sign In to add comment