meppum schrieb:
> I want to check the values of every new instance before I save it to
> make sure that it doesn't match an instance that already exists in the
> database. I know I could use db constraints and use the
> unique_together setting but is there a way to do this in code? Is
> there a way to check just a django model methods using introspection
> and compare the two instances?
>
>   

You can overwrite the save() method and do the checks there. But you can't
do much, except to raise an exception. If a user uses the admin interface,
he might only see 'Internal server error' in his browser.

But I don't think you need introspection. Since you know the object at
coding time, you don't need to check what kind of objects you are dealing
with.

 Thomas

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de


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