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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:13:25+00:00 2026-05-13T00:13:25+00:00

I have a django website that is spilt depending on what user type you

  • 0

I have a django website that is spilt depending on what user type you are, I need to redirect users that are not entitled to see certain aspects of the site,

in my template, I have:

{% if user.get_profile.is_store %}
    <!--DO SOME LOGIC-->
{%endif%}

how would I go about redirecting said store back to the index of the site?

====EDIT====

def downloads(request):
    """
    Downloads page, a user facing page for the trade members to downloads POS etc
    """
    if not authenticated_user(request):
        return HttpResponseRedirect("/professional/")

    if request.user.get_profile().is_store():
        return HttpResponseRedirect("/")

    user = request.user
    account = user.get_profile()

    downloads_list = TradeDownloads.objects.filter(online=1)[:6]
    downloads_list[0].get_thumbnail()
    data = {}
    data['download_list'] = downloads_list

    return render_to_response('downloads.html', data, RequestContext(request))

I implement the answer from thornomad, and now I get his error

Environment:

Request Method: GET
Request URL: http://localhost:8000/professional/downloads
Django Version: 1.1.1
Python Version: 2.6.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.admin',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'sico.news',
 'sico.store_locator',
 'sico.css_switch',
 'sico.professional',
 'sico.contact',
 'sico.shop',
 'tinymce',
 'captcha']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
  92.                 response = callback(request, *callback_args, **callback_kwargs)
File "/var/www/sico/src/sico/../sico/professional/views.py" in downloads
  78.   if request.user.get_profile().is_store():
File "/var/www/sico/src/sico/../sico/shop/models.py" in is_store
  988.         return not self.account is None
File "/usr/local/lib/python2.6/dist-packages/django/db/models/fields/related.py" in __get__
  191.             rel_obj = self.related.model._base_manager.get(**params)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py" in get
  120.         return self.get_query_set().get(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py" in get
  305.                     % self.model._meta.object_name)

Exception Type: DoesNotExist at /professional/downloads
Exception Value: Account matching query does not exist.
  • 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-13T00:13:25+00:00Added an answer on May 13, 2026 at 12:13 am

    You will want to do this, I think, in a view not in the template. So, something like:

    from django.http import HttpResponseRedirect
    
    def myview(request):
        if request.user.get_profile().is_store():
            return HttpResponseRedirect("/path/")
    
        # return regular view otherwise
    

    You could also use a @decorator for the view if you found yourself needing to do this a lot.

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

Sidebar

Ask A Question

Stats

  • Questions 255k
  • Answers 255k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Can you not build a 3rd Assembly that contains the… May 13, 2026 at 10:19 am
  • Editorial Team
    Editorial Team added an answer A delegate type basically specifies the signature of a function… May 13, 2026 at 10:19 am
  • Editorial Team
    Editorial Team added an answer OutgoingResponse.StatusCode is where you'd set the status code, but it's… May 13, 2026 at 10:19 am

Related Questions

We're developing a Python web service and a client web site in parallel. When
I have a Django form that needs to do some client-side validation before submitting
I have a Django view, which receives part of its data from an external
I am building a simple Django app that will use scribd to display documents.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.