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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:16:55+00:00 2026-06-11T03:16:55+00:00

i want to add an ‘EDIT’ link for each posts on index page. but

  • 0

i want to add an ‘EDIT’ link for each posts on index page. but before show this link ; i need to check if session is registered. i mean i need something like this :

{% if session.name=='blabla' %}
    <a href="#">Edit</a>
{% endif %}

i have django.core.context_processors.request on template context processors.

thank you

edit :

here is my detailpage view :

def singlePost(request,postslug):
    post = get_object_or_404(Post, slug=postslug)
    context = {'post':post}
    return render_to_response('detail.html',context,context_instance = RequestContext(request))

when i try this :

def singlePost(request,postslug):
    session=request.session['loggedin']
    post = get_object_or_404(Post, slug=postslug)
    context = {'post':post}
    return render_to_response('detail.html',context,context_instance = RequestContext(request,{'session':'session',}))

it gives template syntax error ( render error)

i tried this :

{% if request.session.name=='blablabla' %}

here is the error :

TemplateSyntaxError at /post/viva-barca

Could not parse the remainder: '=='djangoo'' from 'request.session.name=='djangoo''
  • 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-11T03:16:57+00:00Added an answer on June 11, 2026 at 3:16 am

    i found a different way.

    {% if post.owner == user %}
    
            <div class="right"><a href="{% url editpost post.id %}">Edit</a></div>
    
            {% endif %}
    

    in this way ; i can control user auth too. because there r many users which have their own accounts and posts which are listed in index.html. if i dont write this control ; x user can edit other y user’s post. but now only logged in users can edit their own posts.

    and if there is no any logged in user ; the ‘EDIT’ link is not shown.

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

Sidebar

Related Questions

I want add my custom sidebar next right column all page. Please check this
I want to add Gon ( https://github.com/gazay/gon ) to my activeadmin but I need
In my application i want add this feature . After open the application before
I want add UIGestureRecognizerDelegate to UIWebView,but failed. if [self.view addsubView:webView]; So UIWebView is ok,but
I want add new Feed item on entity persist and update. I write this
I want add my page some div and another tags.I wanna give unique class
I want add user in ActiveDirectory. I use this code private SPUser CreateUser(string strLoginName,
I am working in jQuery script.But a little bit problem i want add the
I want add some methods. And this directive can't help me. var viewModel =
I want add 12 UITextFields in a UITableViewCell (one text field in each row),

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.