Re: RegexField and Admin interface

2007-10-10 Thread oliver
@ Nader : i think you got it, just give it a try! if it doesnt work django will tell you anyway ;) You define a function that gets called on validation of the field is the very abstract view of it as i understand it. On Oct 10, 6:34 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > class Property(mo

Re: RegexField and Admin interface

2007-10-10 Thread Tim Chase
> class Property(models.Model): > def isValidUKPostcode(self, field_data): > p = re.compile(r'^(GIR > 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HIK-Y][0-9](| > [0-9]|[ABEHMNPRVWXY]))|[0-9][A-HJKSTUW]) [0-9][ABD-HJLNP-UW-Z]{2})$') > if not p.match(field_data['postcode']): >

Re: RegexField and Admin interface

2007-10-10 Thread Nader
Thank you for your reaction at the first place! What I have understand of it is that I have to define some class, in your case: class Property(models.Model): and in this class a method (function) in which we can define our regular expression : def isValidReferenceID0(self, field_data):

Re: RegexField and Admin interface

2007-10-10 Thread oliver
Regex is done via a custom validator. works pretty simple. here is an example how i use to check if the entered data is a correct UK postcode (zip code) from django.core import validators you might need to import some thing else as well (import datetime, random, sha, re, os, Image, urllib thats

RegexField and Admin interface

2007-10-09 Thread Nader
Hello I use Django 0.96 and in one of model's field I have to define a 'path' entry in which een Unix path (/usr/people/...) can be given as an input with validation naturally. I would like to use Admin interface and have not found any Built-in Filed of "RegexField" class to use it. class MyMo