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 4534644
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:18:24+00:00 2026-05-21T14:18:24+00:00

I want to check that the user is authorized for certain URLs. I’m using

  • 0

I want to check that the user is authorized for certain URLs. I’m using generic views.

The docs here say the login_required can be passed as an optional arguments but I’m not sure. Something like this maybe: (r'^$', 'archive_index', link_info_dict, 'coltrane_link_archive_index', login_required=True,),

I have this and I would like to be able to use the login_required decorator within the URL. Is it possible? How can I do it?

from django.conf.urls.defaults import *

from coltrane.models import Link

link_info_dict = {
    'queryset': Link.live.all(),
    'date_field': 'pub_date',
}

urlpatterns = patterns('django.views.generic.date_based',
    (r'^$', 'archive_index', link_info_dict, 'coltrane_link_archive_index'),

    (r'^(?P<year>\d{4})/$', 'archive_year', link_info_dict, 'coltrane_link_archive_year'),

    (r'^(?P<year>\d{4})/(?P<month>\w{3})/$', 'archive_month', link_info_dict, 'coltrane_link_archive_month'),

    (r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', 'archive_day', link_info_dict, 'coltrane_link_archive_day'),

    (r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', 'object_detail', link_info_dict, 'coltrane_link_detail'),

)


For example how would I protect this page here(there’s no view to add the login_Required decorator to)?

(r'^$', 'django.views.generic.simple.direct_to_template', {
        'template': 'home.html'
    }, ),
  • 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-21T14:18:24+00:00Added an answer on May 21, 2026 at 2:18 pm

    To use decorators in urls.py you need use real functions instead of their names:

    from django.contrib.auth.decorators import login_required
    import django.views.generic.date_based as views
    
    urlpatterns = patterns('',
        (r'^$', login_required(views.archive_index), link_info_dict,
                'coltrane_link_archive_index'),
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to check when the user double click on applictaion icon that no
I want to have functionality on my application that lets a user check off
i want to check that user upload file is image or not. how i
I want to check that a user is included in a group. In an
I want to check that a file system path is valid and safe to
I want to check that some integer type belongs to (an) enumeration member. For
I want to check that text is now not present on a webpage without
I have the following problem. I want to check that the item clicked on
Before Entering data into a database, I just want to check that the database
I have a whole bunch of mavenised projects, and I want to check that

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.