hello
I have a problem.
I have an application user and another employee. i want to display all the 
fields of user in my employee forms. now, I just redisplay my form user in 
my form employee like that in my template:

{{ form_1.as_p }}
{{ form.as_p }}

this is my view employee:


def add(request, template_name='employee/add.html'):
    if request.method == 'POST':
        form = EmployeeAddForm(data=request.POST)
        form_1 = UserRegisterForm(data = request.POST)
        if form.is_valid() and form_1.is_valid():
            user = form_1.save()
            employee = form.save(commit=False)
            employee.user = user
            user.set_password(user.password)
            user.save()
            employee.save()
       
        else:
            print(form.errors)
    else:
        form = EmployeeAddForm()
        form_1 = UserRegisterForm()
    return render(request, template_name, {'form': form, 'form_1' : form_1, 
'added': added})

but I think that it'is not the best method. can you give me another method 
which will be more intelligent.
thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2b4b2b79-9fcb-4949-9683-0ea5d104de3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to