K
K
Karina2014-05-10 23:05:53
Django
Karina, 2014-05-10 23:05:53

Django. How to keep in shape

PS the title had to be renamed, tk. the task was reduced - how to keep the form and I was advised accordingly.
I still have, in addition to the main app, only one app - entry_or_registration.
In the main app'e in urls I write:

url(r'see_you_later/', include('entry_or_registration.urls')),

In app'e - entry_or_registration in url:
url(r'^see_you_later/', 'entry_or_registration.views.save_registration'),

In view:
def save_registration (request ):
if request.method == 'POST':
        form_user = Form_registration_user (request.POST)
        if form_user.is_valid ():
            form_user.save()
return render_to_response('see_you_later.html')

in html:
<form name="registration" method="post" action="see_you_later/">
    {% csrf_token %}
    {{ form_registration_user.as_table }}
    {{ form_registration_security.as_p }}
    <input type="submit" value="SignUp">

I have absolutely nothing going on. No, of course, when you click on the button in the browser line, it changes to: site_address/see_you_later, but that's all, the see_you_later.html page is not shown, although it is.
In short, this function is simply not called.
I don't know what to do anymore.
Thanks everyone for the replies.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cyril, 2014-05-13
@iKapex

I myself am inexperienced in django, but I'll try :)
It's not clear what you want. The fields are really set in the NameForm in fields, and in the views there is the logic of processing the form after the user fills it out. Most likely there was something like this:

if form.is_valid():
    args= form.save(commit=False) # принимаем данные от формы
    args['поле_которое_заполняется_само'] = запрос_из_базы_данных
    ...
    args.save()

that is, we have N fields in the model, 2 of them are selected by the user, the rest we fill in ourselves, with selections from the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question