ModelForm:
class ArticleForm(ModelForm):
title =
forms.CharField(widget=forms.TextInput(attrs={'class':'input_visible_title',
'title' :
_(u'Tytuł'),}), max_length=255, min_length=3)
content =
forms.CharField(widget=forms.Textarea(attrs={'class':'add_editor'}),
min_length=200)
image_proposal =
forms.URLField(widget=forms.TextInput(attrs={'class':'input_visible_title',}),
max_length=255, required=False, verify_exists=False)
tags_tmp =
forms.CharField(widget=forms.TextInput(attrs={'class':'input_visible_title',}),
max_length=255, min_length=1)
categories =
forms.ModelMultipleChoiceField(queryset=Category.objects.all(),
widget=forms.CheckboxSelectMultiple)
is_sketch = forms.BooleanField(required=False)
class Meta:
model = Article
fields = ('title', 'content', 'categories', 'tags_tmp',
'image_proposal')
Model:
class Article(models.Model):
....
image_proposal = models.URLField(max_length=255, verify_exists=False,
blank=True)
....
def save(self):
if not self.pk:
self.slug = slughifi(self.title)
super(Article, self).save()
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.