I saw this example in the documentation: http://www.djangoproject.com/documentation/forms/#validators
But where does this code live? Does this go into my models.py as a subclass of my Model, or is it a separate file? Advice appreciated, Brandon On May 14, 6:28 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I've been using Django for awhile, but haven't had to customize the > admin, until now, and...I'm stuck. > > Since newforms-admin is supposed to be more extensible, I'm running > the latest of that, and have defined a simple model: > > from django.db import models > from django.contrib import admin > > class Link(models.Model): > friendly_name = models.CharField(max_length=255) > instructor = models.CharField(max_length=100) > instructor_email = models.EmailField() > url = models.URLField('Website Address', verify_exists=False, > help_text='Ener the full URL including http://') > position = models.PositiveSmallIntegerField(editable=False) > > def __unicode__(self): > return self.friendly_name > > class LinkAdmin(admin.ModelAdmin): > list_display = ('friendly_name',) > ordering = ['position'] > > admin.site.register(Link, LinkAdmin) > > What I need an example of is how to do a custom validator for the > ModelAdmin. How can I do something as simple as this: > > if self.instructor == 'some val': > #throw an error > > and have it the error show up in the admin? I've never done this > before so please bear with me. Django absolutely rocks, and I've had > great success with it over the past couple of months. I just need to > see a sample and can probably take it from there. > > Thanks a million, > Brandon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---