Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7558737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:26:54+00:00 2026-05-30T12:26:54+00:00

I have just started learning django. I created a form from django models. On

  • 0

I have just started learning django. I created a form from django models. On the click of submit button the data is getting stored in database. Now what i want is something like the one given below :

#view.py
def contact(request):
  if request.method == 'POST':
  form = UserForm(request.POST)
  if form.is_valid():
            user = form.save()
            return HttpResponseRedirect("/contact/create_db")

#urls.py
(r'^contact/$', views.contact),
(r'^contact/create_db$', views.do_create),

Now when i define do_create function in views.py i want to pass the arguments(user data of user form) like this:

def do_create(request, password, dbname, admin_password, confirm_password, demo_data=False, language=None, **kw):

Is this possible using django. How can this be achieved.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:26:55+00:00Added an answer on May 30, 2026 at 12:26 pm

    All you’re asking here is how to get the value of the saved user in a subsequent view.

    Well, this is easy. Once the user is saved, it (like any model instance) gets a pk value. You can use this in the URL for the subsequent view.

    url(r'^contact/create_db/(?P<user_id>\d+)/$', views.do_create, 'do_create'),
    

    In contact:

    from django.shortcuts import redirect
    
    ...
    
    user = form.save()
    return redirect('do_create', kwargs={'user_id': user.pk})
    

    And in do_create:

    def do_create(request, user_id):
        user = User.objects.get(pk=user_id)
    

    Note the way I’ve passed in the URL name and arguments into redirect, rather than hard-coding the URL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started learning python and am getting caught up. I come from
G'Day Programmers, I am from Java background however I have just started learning C++
I have just started learning ruby reading from different resources. One of them is
I have just started learning MVVM. I've made the application from scratch by following
I have just started learning and have put together the form below. The confusion
I just started learning python and django and I have a question. I got
I have just started learning Erlang and am trying out some Project Euler problems
I have just started learning Jquery and am new to writing javascript (I am
I have just started learning MVVM and having a dilemna. If I have a
I have just started learning NHibernate. Over the past few months I have been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.