On 9/22/2010 4:30 PM, Anton Danilchenko wrote:
> Ihave found solution.
>
> I have changed only Form class:
>
> 1) added field for show text input field
> phones = forms.CharField()
>
> 2) I have create in my Form instance method clear_phones() where I
> check phones and save it all to databa
Ihave found solution.
I have changed only Form class:
1) added field for show text input field
phones = forms.CharField()
2) I have create in my Form instance method clear_phones() where I
check phones and save it all to database and get Phone model ids for
this phone numbers. And return thi
Now I have next solution (but still need your help).
1) I have added to my form custom field CharField for render field as
input
2) I have created Form method clean_phones() for check all values is
valid
3) in views.py I have get field contents, split it by comma and delete
all non-numbers. In
Thanks. I have read this article.
In my Form I have added validation for check phone numbers. All right
- I show user error message if given incorrect phone number. This is
simple.
I need to save this phone numbers in model Phone if all phone numbers
valid and all other fields in this form is va
read this here I think this'll explain what you're wanting.
http://docs.djangoproject.com/en/dev/ref/forms/validation/
On Tue, Sep 21, 2010 at 1:50 PM, Anton Danilchenko <
anton.danilche...@gmail.com> wrote:
> Message - this is a rental proposition (rooms, floor, cost, area,
> country, cirty and
Message - this is a rental proposition (rooms, floor, cost, area,
country, cirty and contact phones).
Visitors can create new messages (message - this is a rent
proposition) and enter list of own phones (one or more phones). My
application store this phones not in char field, but save each phone
n
PersonallyI don't like the idea of adding multiple phone numbers as
comma separated values. What happens when a user's trying to add more phone
numbers than your charField's max_length?
So let me see if I understand what's going on here...
You have a problem where exists apartments for rent.
Also I need get list of all phones as with many-to-many relationship:
m = Message.objects.get(1)
for phone in m.phones:
ptint phone
On 21 сен, 20:15, Anton Danilchenko
wrote:
> I describe my task more reallistical.
>
> This is application for rent an apartment. User can create new message
> w
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 p
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.
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
ne
Let me rephrase my first statement...You can use the admin for fine grained
control of your data formats and characters. But don't use the Database to
control the characters and formats. Use the database as a storage and make
sure that anything you store gets cleaned.
n
On Tue, Sep 21, 2010 at 9:
First I don't think you should be using the admin for such fine grained
control of your data formats.
BUT if you do want to do that you would want to do your validation in custom
admin forms. (created in your admin.py to do cleans on the data that's being
submitted)
Second I wouldn't do a manytoma
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 t
14 matches
Mail list logo