Hi all!

Please, help me undestand, how to solve next task.

I am show for user form with two fields: user name and text field,
where user input list of phones, separated by comma. User sholud enter
one or more phones separated by comma. If user enter not valid number
- we show error message like this "Phone 12345 is not valid. Please,
enter valid phone numbers separated by comma".

I have next two models:

class Phone(models.Model):
  number = models.CharField(max_length=20)

class UserInfo(models.Model):
  name = models.CharField(max_length=70)
  phones = models.ManyToManyField(Phone)

User should enter numbers in CharField in format 0XX XXX XXXX. But, I
need save phone in database in format 0XXXXXXXXXX (only number without
spaces and other non-numbers digits).

Please, can you help me in this. I am new in Django, and I am read
more articles and not found solution. I think that I need create
custom fields for form and model.

P.S. Also, in admin section I should see CharField instead of
ManyToManyField.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to