Hello!

How can check if field is filling in the form using custom
manipuplator? The idia is, if user has permisson to edit article or has
authenticated field 'Publish' is visible in form, if not visible add
article with publish = 0. How to do this? My code is not working...

        self.fields = (
            forms.TextField(field_name='headline', is_required=True,
maxlength=100), 
            forms.HiddenField(field_name='author'),
            forms.LargeTextField(field_name='brief', is_required=True),
            forms.LargeTextField(field_name='body'),
            forms.IntegerField(field_name='publish', is_required=True),
                )
    def save(self, new_data):
        obj = Article(
            headline = new_data['headline'],
            author = User.objects.get(pk=self.request.user.id),
            brief = new_data['brief'],
            body = new_data['body'],
            if not new_data.has_key('publish'):
                publish = 0,
            else:
                publish = new_data['publish'],
        )
        obj.save()

Thanks.

-- 
Всего наилучшего! Григорий
greg [at] anastasia [dot] ru
Письмо отправлено: 2006/11/08 15:58

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to