Hi,

i am trying to build an authorisation system for the admin site.
The authorisation should not only be based on user, group and type of
the object, but also
on contents the user just typed in.
I assume that i have to override the clean() methods of the ModelAdmin
classes.

First i tried this:

class MyForm(forms.ModelForm):
   def clean(self):
      #do authorisation here
      return super(MyForm, self).clean()

class FooAdmin(admin.ModelAdmin):
   form = MyForm
   model = Foo

The Problem here is that i can not raise ValidationErrors for single
fields.

Then i found this: 
http://code.djangoproject.com/wiki/NewformsHOWTO#Q:HowdoIaddcustomvalidation
The second example of this question seems to be the right one, but i
don't understand how to
create a custom clean() method here.

A quick an dirty example is very appreciated ;)


Greets,
Sebastian

--~--~---------~--~----~------------~-------~--~----~
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