I describe my task more reallistical. This is application for rent an apartment. User can create new message with information about apartment, and also add one or more contact phone numbers. One user, without registration, can create more that one message on the site. For one message can add one phone number, for other message add two phones.
I need to save only one copy of phone number in database in format XXXXXXXX. For each phone I can set if this phone in black list or not (model Phone have property "blocked" by default setted to False). I want to save phone numbers in model Phone, and messages in model Message. But, people can see input text field (CharField) where enter one or more phone numbers separated by comma. class Phone(models.Model): number = models.CharField(max_length=20) blocked = models.BooleanField(default=False) class Message(models.Model): # ... information about count of rooms, floor, cost, etc ... phones = models.ManyToManyField(Phone) Nick, thank you for you help. You are really very good people! On 21 сен, 18:12, "nick.l...@gmail.com" <nick.l...@gmail.com> wrote: > Maybe I don't understand your problem. > > It sounds to me like your trying to make this way more difficult than it > needs to be. > > Also it sounds to me like your trying to assign the same phone number to > multiple people. (which is fine) But doesn't make a lot of sense to me in a > practical application. > > n > > On Tue, Sep 21, 2010 at 9:59 AM, Anton Danilchenko < > > > > > > anton.danilche...@gmail.com> wrote: > > In my case, I have Users with equal phone numbers. And I need only > > ManyToMany relationship. > > > I need create custom field for get information from CharFiels, > > validate this data, clean and save to datastore in separate model. If > > this phone already exists - we get ID of this phone. And, if this is a > > new phone number - we insert this phone to separate model and get new > > ID. > > > -- > > 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<django-users%2bunsubscr...@google > > groups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/django-users?hl=en. > > -- > Guadajuko! Vamos a correr! > -"Cool! we are going to run!" -- 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.