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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:34:34+00:00 2026-06-15T11:34:34+00:00

Hello i use @login_required to restrict access to some pages that stores bookmarks for

  • 0

Hello i use @login_required to restrict access to some pages that stores bookmarks for users, but in some cases i want the user to access only his bookmarks and must be stopped if he try to enter a url that edits a bookmark that belongs to another user. how can i do that?

  • 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-15T11:34:35+00:00Added an answer on June 15, 2026 at 11:34 am

    @login_required can help you make sure the user is logged in to even access the view.

    Once the view is accessed you could check to make sure the user is allowed to access the bookmarks, and only fetch bookmarks they are allowed to access

    for example if your url looked something like

    /bookmarks/ and corresponds to function bookmarks

    @loggin_required
    def bookmarks():
      # only fetch book makrs for this user
      bookmarks = Bookmarks.objects.filter(user=request.user)
    

    This will make sure user is logged in to access the url and that book marks are only displayed for the user that is viewing the page. You could add some sort of permission system if some users can view other users bookmarks

    if this view were to show all book marks for a user and you wanted to provide a url to edit bookmarks or something like

    bookmarks/{{ bookmark_id }}/edit that maps to edit_bookmark

    @login_required
    def edit_bookmark(bookmark_id):
       # user is guarenteed to be logged in so request.user is available
       # your permission system will depend on how you authenticate whether a user can edit
       # a bookmark or not
       # CHECK if user has permission to edit bookmark
       pass
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some different Map/Reduces functions that I use in my project. But one
Hello I have use DOMDocs in the past but I am stuck how to
hello i want to use a texture on a cube (created by glutsolidcube()), how
hello friends i want to use toggle on <li> when one <li> is open
hello guys i am try to use the StringUtils.remove Method but the below exception
hello I have this code that use to sort a datatable. Dim sortingIndex As
Hello Sir i want send list of data to php server i use following
Hello I am new to mono android I want to use shared preferences for
Hello everyone I'm trying to use sharp property like photoshop in Css but how
My goal is to use the FB login button so that FB users can

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.