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

  • SEARCH
  • Home
  • 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 8532639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:45:39+00:00 2026-06-11T09:45:39+00:00

i have blog system which is every user have their own main page like

  • 0

i have blog system which is every user have their own main page like ;

127.0.0.1/username

and every user’s login screen located at : 127.0.0.1/username/panel

and again here is their admin panel : 127.0.0.1/username/admin

in login page ; when i submit ; it must redirect the user to admin panel.

but i need to reach the username which is in url at the moment. i think i shoud use regexp. but how? i am bad about regexp.

here is my urls.py:

urlpatterns = patterns('blog.views',
    url(r'^blog/(?P<username>[-\w]+)/$',view='index', name='index'),
    url(r'^blog/(?P<username>[-\w]+)/post/(?P<postslug>[-\w]+)',view='singlePost', name='view_blog_post'),
    url(r'^blog/(?P<username>[-\w]+)/panel/$', view='loguserin'),
    url(r'^blog/(?P<username>[-\w]+)/admin/$', view='adminView', name='admin'),
    url(r'^blog/(?P<username>[-\w]+)/admin/loggedout/$', view='logout', name='logout'),
    url(r'^blog/(?P<username>[-\w]+)/admin/addpost/$', view='addpost',name='addpost'),
    url(r'^blog/(?P<username>[-\w]+)/admin/editpost/(?P<post_id>\d+)', view='editPost', name='editpost'),
    url(r'^blog/(?P<username>[-\w]+)/admin/delete/(?P<post_id>\d+)', view='delete_post', name='deletePost'),

)

and here is my views.py [login part]:

def loguserin(request,username):
    if request.method=='POST':
        uname = request.POST['username']
        password = request.POST['password']
        user = authenticate(username=uname, password=password)
        form = LoginForm(request.POST)
        if form.is_valid():
            if user is not None:
                request.session['loggedin']="djangoo"
                login(request, user)
                return HttpResponseRedirect('/admin/') #--> ????
    else:
        form = LoginForm()

    return render_to_response('login.html',{'form':form,},context_instance=RequestContext(request))
  • 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-06-11T09:45:41+00:00Added an answer on June 11, 2026 at 9:45 am

    Actually, you already have the username:

    from django.core.urlresolvers import reverse
    return HttpResponseRedirect(reverse('admin', args=[uname]))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a system in which the user can build thre own navigation
I have a Wordpress blog and the only user input is the commenting system.
I have a blog installed in www.foo.com/wp/ and would like all requests that go
I have a blog (wordpress) and a facebook fan-page for my blog (with more
I have 1 blog say xyz.blogspot.com ,now am uploading my own website,so I want
I'm currently creating blog system, which I hope to turn into a full CMS
I have a blog written in reStructuredText which I currently have to manually convert
I have created an NSStatusBar cocoa application which sits in the system status bar.
I have put up a new blog which uses Toto with Rails 3 and
I have a system which after getting a message - enqueues it (write to

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.