Re: Implementing a django cart using Django cart module Error: unhashable type dict

2018-09-04 Thread carl collins
Thanks Gopal

On Tue, Sep 4, 2018 at 4:12 PM  wrote:

> Dear Carl,
>>
>
>   I'm sorry, I've no idea what the Cart is. I'm assuming that it is a
> class which can be instantiated with some dictionary data.
>   So you try passing request.data instead of just request to the Cart.
>
> Try to check by printing request.data, it'll be a dict.
> FYI you can check the below link, may be you can find the Root cause for
> your error.
>
> https://alysivji.github.io/quick-hit-hashable-dict-keys.html
>
> Thanks,
> Gopal
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bc1db1cf-b36f-434c-95b1-df82f631dd38%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEPm0bzOAdz5cDVsY7H9WwiSaapPH1he03Ageq_mObO3oUHtXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Implementing a django cart using Django cart module Error: unhashable type dict

2018-09-04 Thread pgopal1166

>
> Dear Carl,
>

  I'm sorry, I've no idea what the Cart is. I'm assuming that it is a class 
which can be instantiated with some dictionary data.
  So you try passing request.data instead of just request to the Cart.

Try to check by printing request.data, it'll be a dict.
FYI you can check the below link, may be you can find the Root cause for 
your error.

https://alysivji.github.io/quick-hit-hashable-dict-keys.html

Thanks,
Gopal

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bc1db1cf-b36f-434c-95b1-df82f631dd38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trying to build a cart using django cart. "" error unhashable type dict ""

2018-09-04 Thread Julio Biason
Hi Carl,

The problem seems to be the use of `get_template`:
https://docs.djangoproject.com/en/2.1/topics/templates/#usage

The second parameter (the one you're using a dict) is not the values to
pass to the template, but the name of the template engine to be used.

I'd suggest using `render` (
https://docs.djangoproject.com/en/2.1/topics/http/shortcuts/#render)
instead, which is more common than trying to get a template from a specific
loader.

On Tue, Sep 4, 2018 at 2:37 AM, carl collins 
wrote:

> Here is the code for view.py in my cart app  please help(also see the
> screenshot):
>
>
> from django.template import loader
> from django.http import HttpResponse
> from django.template.loader import render_to_string
> import django.template.loader
>
>
> from cart.cart import Cart
> from .models import Product
> '''from cart.models import Category, Product'''
>
>
> #gallerydefault view
> def index(request):
> #prepare the models
> #empty
> #prepare the template
> template = loader.get_template('templates/cart.html',
> dict(cart=Cart(request))  )
> #prepare the context
> context = {'request':request}
> return HttpResponse(template.render(context, request))
>
> def add_to_cart(request, product_id, quantity):
> product = Product.objects.get(id=product_id)
> cart = Cart(request)
> cart.add(product, product.unit_price, quantity)
>
> def remove_from_cart(request, product_id):
> product = Product.objects.get(id=product_id)
> cart = Cart(request)
> cart.remove(product)
>
>
> def get_cart(request):
>
> template = loader.get_template('templates/cart.html', dict(cart =
> Cart(request)))
>
> #prepare the context
> context = {'request':request}
> return HttpResponse(template.render(context, request))
> return HttpResponse(template.render(context, request))
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/a78552f7-9973-456d-b0d5-79602f4bbf5c%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEM7gE1y54BKXnbmdkx72ew32HhtUBkV-0uPJPQ8pqiq8VRoqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trying to build a cart using django cart. "" error unhashable type dict ""

2018-09-04 Thread RONAK JAIN
Are you not using class ?

On Tue, Sep 4, 2018 at 6:44 PM carl collins 
wrote:

> Here is the code for view.py in my cart app  please help(also see the
> screenshot):
>
>
> from django.template import loader
> from django.http import HttpResponse
> from django.template.loader import render_to_string
> import django.template.loader
>
>
> from cart.cart import Cart
> from .models import Product
> '''from cart.models import Category, Product'''
>
>
> #gallerydefault view
> def index(request):
> #prepare the models
> #empty
> #prepare the template
> template = loader.get_template('templates/cart.html',
> dict(cart=Cart(request))  )
> #prepare the context
> context = {'request':request}
> return HttpResponse(template.render(context, request))
>
> def add_to_cart(request, product_id, quantity):
> product = Product.objects.get(id=product_id)
> cart = Cart(request)
> cart.add(product, product.unit_price, quantity)
>
> def remove_from_cart(request, product_id):
> product = Product.objects.get(id=product_id)
> cart = Cart(request)
> cart.remove(product)
>
>
> def get_cart(request):
>
> template = loader.get_template('templates/cart.html', dict(cart =
> Cart(request)))
>
> #prepare the context
> context = {'request':request}
> return HttpResponse(template.render(context, request))
> return HttpResponse(template.render(context, request))
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a78552f7-9973-456d-b0d5-79602f4bbf5c%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BAqMUfoUms07suSkNJuCCZMjn3iHAwqyonerU1K%2BE%3Dc%2B43m6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Trying to build a cart using django cart. "" error unhashable type dict ""

2018-09-04 Thread carl collins
Here is the code for view.py in my cart app  please help(also see the 
screenshot):  


from django.template import loader
from django.http import HttpResponse
from django.template.loader import render_to_string
import django.template.loader


from cart.cart import Cart
from .models import Product
'''from cart.models import Category, Product'''


#gallerydefault view
def index(request):
#prepare the models
#empty
#prepare the template
template = loader.get_template('templates/cart.html', 
dict(cart=Cart(request))  )
#prepare the context
context = {'request':request}
return HttpResponse(template.render(context, request))

def add_to_cart(request, product_id, quantity):
product = Product.objects.get(id=product_id)
cart = Cart(request)
cart.add(product, product.unit_price, quantity)

def remove_from_cart(request, product_id):
product = Product.objects.get(id=product_id)
cart = Cart(request)
cart.remove(product)


def get_cart(request):
   
template = loader.get_template('templates/cart.html', dict(cart = 
Cart(request))) 

#prepare the context
context = {'request':request}
return HttpResponse(template.render(context, request))
return HttpResponse(template.render(context, request))

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a78552f7-9973-456d-b0d5-79602f4bbf5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Implementing a django cart using Django cart module Error: unhashable type dict

2018-09-04 Thread carl collins
from django.template import loader
from django.http import HttpResponse
from django.template.loader import render_to_string
import django.template.loader
# Create your views here.

# Create your views here.

from cart.cart import Cart
from .models import Product
'''from cart.models import Category, Product'''


#gallerydefault view
def index(request):
#prepare the models
#empty
#prepare the template
template = loader.get_template('templates/cart.html', 
dict(cart=Cart(request))  )
#prepare the context
context = {'request':request}
return HttpResponse(template.render(context, request))

def add_to_cart(request, product_id, quantity):
product = Product.objects.get(id=product_id)
cart = Cart(request)
cart.add(product, product.unit_price, quantity)

def remove_from_cart(request, product_id):
product = Product.objects.get(id=product_id)
cart = Cart(request)
cart.remove(product)


def get_cart(request):


template = loader.get_template('templates/cart.html', dict(cart = 
Cart(request))) 

#prepare the context
context = {'request':request}
return HttpResponse(template.render(context, request))
return HttpResponse(template.render(context, request))

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2a596660-1cc6-46df-a3a6-465a7ff910f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: unhashable type: 'dict'

2016-03-19 Thread Deepanshu Sagar
Yes, I got that working, thanks.  :)

On Tuesday, March 15, 2016 at 7:54:02 PM UTC+5:30, Bruno Barbosa wrote:
>
> you forgot the function name auth_views.logout as a second parameter as 
> mentioned above.
>
> try it:
> url(r'^logout/$', *auth_views.logout*, {'next_page': 'boardgames_home'}, 
> name='boardgames_logout'),
>
> --
> Bruno Barbosa
> Web Developer
> *brunobarbosa.com.br *
>
> On Tue, Mar 15, 2016 at 10:32 AM, Deepanshu Sagar  > wrote:
>
>> yes, thank you for the prompt reply, I am using 
>>
>> from django.contrib.auth import views as auth_views
>>
>> I need to redirect my webpage to "board_games" main page when the user 
>> logs out. 
>> can you please direct me to the correct way to do that? 
>>
>> Thanks in advance. 
>>
>>
>>
>> On Tuesday, March 15, 2016 at 5:45:07 PM UTC+5:30, luisza14 wrote:
>>
>>> You are correct, your problem is in logout url , because you need to 
>>> pass a function not a duct as second parameter.
>>>
>>> Are you using django auth views ?
>>>
>>>
>>>
>>> https://docs.djangoproject.com/en/1.9/topics/auth/default/#django.contrib.auth.logout
>>>
>>>
>>> El martes, 15 de marzo de 2016, Deepanshu Sagar  
>>> escribió:
>>> > Hello,
>>> > i am getting below error while accessing http://localhost:8000/login/.
>>> > 
>>> 
>>> >
>>> > Below are the chaining codes.
>>> > boardgames\urls.py
>>> > 
>>> 
>>> > boardgames\templates\login.html
>>> > 
>>> 
>>> >
>>> > NOTE: before adding "
>>> >
>>> > url(r'^logout/', {'next_page': 'boardgames_home'}, 
>>> name='boardgames_logout')
>>> >
>>> > to boardgames\urls.py. the access was working fine.
>>> > below is the settings.py
>>> >
>>> > """
>>> > Django settings for boardgames project.
>>> >
>>> > For more information on this file, see
>>> > https://docs.djangoproject.com/en/1.6/topics/settings/
>>> >
>>> > For the full list of settings and their values, see
>>> > https://docs.djangopro ect.com/en/1.6/ref/settings/
>>> > """
>>> >
>>> > # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
>>> > import os
>>> > BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>> >
>>> >
>>> > # Quick-start development settings - unsuitable for production
>>> > # See 
>>> https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
>>> >
>>> > # SECURITY WARNING: keep the secret key used in production secret!
>>> > SECRET_KEY = '_p4ga=y!6rbqqv3&4)v7a*qtjb*8tedegd3=8#(p-2dl6a@3#v'
>>> >
>>> > # SECURITY WARNING: don't run with debug turned on in production!
>>> > DEBUG = True
>>> >
>>> >
>>> > ALLOWED_HOSTS = []
>>> >
>>> >
>>> > # Application definition
>>> >
>>> > INSTALLED_APPS = (
>>> > 'django.contrib.admin',
>>> > 'django.contrib.auth',
>>> > 'django.contrib.contenttypes',
>>> > 'django.contrib.sessions',
>>> > 'django.contrib.messages',
>>> > 'django.contrib.staticfiles',
>>> > 'main',
>>> > 'tictactoe',
>>> > )
>>> >
>>> > MIDDLEWARE_CLASSES = (
>>> > 'django.contrib.sessions.middleware.SessionMiddleware',
>>> > 'django.middleware.common.CommonMiddleware',
>>> > 'django.middleware.csrf.CsrfViewMiddleware',
>>> > 'django.contrib.auth.middleware.AuthenticationMiddleware',
>>> > 'django.contrib.messages.middleware.MessageMiddleware',
>>> > 'django.middleware.clickjacking.XFrameOptionsMiddleware',
>>> > )
>>> >
>>> > ROOT_URLCONF = 'boardgames.urls'
>>> >
>>> > TEMPLATES = [
>>> > {
>>> > 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>>> > 'DIRS': [os.path.join(BASE_DIR, 'templates')],
>>> > 'APP_DIRS': True,
>>> > 'OPTIONS': {
>>> > 'context_processors': [
>>> > 'django.core.context_processors.request',
>>> > 'django.template.context_processors.debug',
>>> > 'django.template.context_processors.request',
>>> > 'django.contrib.auth.context_processors.auth',
>>> > 'django.contrib.messages.context_processors.messages',
>>> > ],
>>> > },
>>> > },
>>> > ]
>>> >
>>> >
>>> > WSGI_APPLICATION = 'boardgames.wsgi.application'
>>> >
>>> >
>>> > # Database
>>> > # https://docs.djangoproject.com/en/1.6/ref/settings/#databases
>>> >
>>> > DATABASES = {
>>> > 'default': {
>>> > 'ENGINE': 'django.db.backends.sqlite3',
>>> > 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
>>> > }
>>> > }
>>> >
>>> > # Internationalization
>>> > # https://docs.djangoproject.com/en/1.6/topics/i18n/
>>> >
>>> > LANGUAGE_CODE = 'en-us'
>>> >
>>> > TIME_ZONE = 'UTC'
>>> >
>>> > USE_I18N = True
>>> >
>>> > USE_L10N = True
>>> >
>>> > USE_TZ = True
>>> >
>>> >
>>> > # Static files (CSS, JavaScript, Images)
>>> > # https://docs.djangoproject.com/en/1.6/howto/static-files/
>>> >
>>> > STATIC_URL = '/static/'
>>> > STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
>>> >
>>> > LOGIN_URL = 'boardgames_login'
>>> > LOGOUT_URL = 'boardgames_logout'
>>> > LOGIN_REDIRECT_URL = 'user_home'
>>> >
>>> > I am new to Django learning.
>>> > Please let me know if more details are required.
>>> > Regards
>>> > Deepanshu
>>> >
>>> > --
>>> > You received this message because 

Re: unhashable type: 'dict'

2016-03-19 Thread Deepanshu Sagar
hello guys, 

On clicking "*Click here to login*  " I was 
able to move my webpage to http://localhost:8000/login/ with 

"from django.contrib.auth.views.login"


by entering the username and password, I am getting below error. 
"AttributeError: 'Manager' object has no attribute 'games_for_user'"


user/views.py contains: 

from tictactoe.models import Game


@login_required
def home(request):
my_games = Game.objects.games_for_user(request.user)
active_games = my_games.filter(status="A")
finished_games = my_games.exclude(status="A")
waiting_games = active_games.filter(next_to_move=request.user)
other_games = active_games.exclude(next_to_move=request.user)
context = {'other_games': other_games,
   'waiting_games': waiting_games,
   'finished_games': finished_games}
return render(request, "user/home.html", context)


So, Game is not getting imported with: 

from tictactoe.models import Game


below is my directory tree: 


any help is appreciated. 

thanks
Deepanshu

On Wednesday, March 16, 2016 at 6:42:45 PM UTC+5:30, Deepanshu Sagar wrote:

> Yes, I got that working, thanks.  :)
>
> On Tuesday, March 15, 2016 at 7:54:02 PM UTC+5:30, Bruno Barbosa wrote:
>>
>> you forgot the function name auth_views.logout as a second parameter as 
>> mentioned above.
>>
>> try it:
>> url(r'^logout/$', *auth_views.logout*, {'next_page': 'boardgames_home'}, 
>> name='boardgames_logout'),
>>
>> --
>> Bruno Barbosa
>> Web Developer
>> *brunobarbosa.com.br *
>>
>> On Tue, Mar 15, 2016 at 10:32 AM, Deepanshu Sagar  
>> wrote:
>>
>>> yes, thank you for the prompt reply, I am using 
>>>
>>> from django.contrib.auth import views as auth_views
>>>
>>> I need to redirect my webpage to "board_games" main page when the user 
>>> logs out. 
>>> can you please direct me to the correct way to do that? 
>>>
>>> Thanks in advance. 
>>>
>>>
>>>
>>> On Tuesday, March 15, 2016 at 5:45:07 PM UTC+5:30, luisza14 wrote:
>>>
 You are correct, your problem is in logout url , because you need to 
 pass a function not a duct as second parameter.

 Are you using django auth views ?



 https://docs.djangoproject.com/en/1.9/topics/auth/default/#django.contrib.auth.logout


 El martes, 15 de marzo de 2016, Deepanshu Sagar  
 escribió:
 > Hello,
 > i am getting below error while accessing http://localhost:8000/login/
 .
 > 
 
 >
 > Below are the chaining codes.
 > boardgames\urls.py
 > 
 
 > boardgames\templates\login.html
 > 
 
 >
 > NOTE: before adding "
 >
 > url(r'^logout/', {'next_page': 'boardgames_home'}, 
 name='boardgames_logout')
 >
 > to boardgames\urls.py. the access was working fine.
 > below is the settings.py
 >
 > """
 > Django settings for boardgames project.
 >
 > For more information on this file, see
 > https://docs.djangoproject.com/en/1.6/topics/settings/
 >
 > For the full list of settings and their values, see
 > https://docs.djangopro ect.com/en/1.6/ref/settings/
 > """
 >
 > # Build paths inside the project like this: os.path.join(BASE_DIR, 
 ...)
 > import os
 > BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 >
 >
 > # Quick-start development settings - unsuitable for production
 > # See 
 https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
 >
 > # SECURITY WARNING: keep the secret key used in production secret!
 > SECRET_KEY = '_p4ga=y!6rbqqv3&4)v7a*qtjb*8tedegd3=8#(p-2dl6a@3#v'
 >
 > # SECURITY WARNING: don't run with debug turned on in production!
 > DEBUG = True
 >
 >
 > ALLOWED_HOSTS = []
 >
 >
 > # Application definition
 >
 > INSTALLED_APPS = (
 > 'django.contrib.admin',
 > 'django.contrib.auth',
 > 'django.contrib.contenttypes',
 > 'django.contrib.sessions',
 > 'django.contrib.messages',
 > 'django.contrib.staticfiles',
 > 'main',
 > 'tictactoe',
 > )
 >
 > MIDDLEWARE_CLASSES = (
 > 'django.contrib.sessions.middleware.SessionMiddleware',
 > 'django.middleware.common.CommonMiddleware',
 > 'django.middleware.csrf.CsrfViewMiddleware',
 > 'django.contrib.auth.middleware.AuthenticationMiddleware',
 > 'django.contrib.messages.middleware.MessageMiddleware',
 > 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 > )
 >
 > ROOT_URLCONF = 'boardgames.urls'
 >
 > TEMPLATES = [
 > {
 > 'BACKEND': 'django.template.backends.django.DjangoTemplates',
 > 'DIRS': [os.path.join(BASE_DIR, 'templates')],
 > 'APP_DIRS': True,
 > 'OPTIONS': {
 > 'context_processors': [
 > 'django.core.context_processors.request',
 > 'django.template.context_processors.debug',
 > 

Re: unhashable type: 'dict'

2016-03-15 Thread Bruno Barbosa
you forgot the function name auth_views.logout as a second parameter as
mentioned above.

try it:
url(r'^logout/$', *auth_views.logout*, {'next_page': 'boardgames_home'},
name='boardgames_logout'),

--
Bruno Barbosa
Web Developer
*brunobarbosa.com.br *

On Tue, Mar 15, 2016 at 10:32 AM, Deepanshu Sagar 
wrote:

> yes, thank you for the prompt reply, I am using
>
> from django.contrib.auth import views as auth_views
>
> I need to redirect my webpage to "board_games" main page when the user
> logs out.
> can you please direct me to the correct way to do that?
>
> Thanks in advance.
>
>
>
> On Tuesday, March 15, 2016 at 5:45:07 PM UTC+5:30, luisza14 wrote:
>
>> You are correct, your problem is in logout url , because you need to pass
>> a function not a duct as second parameter.
>>
>> Are you using django auth views ?
>>
>>
>>
>> https://docs.djangoproject.com/en/1.9/topics/auth/default/#django.contrib.auth.logout
>>
>>
>> El martes, 15 de marzo de 2016, Deepanshu Sagar 
>> escribió:
>> > Hello,
>> > i am getting below error while accessing http://localhost:8000/login/.
>> >
>> 
>> >
>> > Below are the chaining codes.
>> > boardgames\urls.py
>> >
>> 
>> > boardgames\templates\login.html
>> >
>> 
>> >
>> > NOTE: before adding "
>> >
>> > url(r'^logout/', {'next_page': 'boardgames_home'},
>> name='boardgames_logout')
>> >
>> > to boardgames\urls.py. the access was working fine.
>> > below is the settings.py
>> >
>> > """
>> > Django settings for boardgames project.
>> >
>> > For more information on this file, see
>> > https://docs.djangoproject.com/en/1.6/topics/settings/
>> >
>> > For the full list of settings and their values, see
>> > https://docs.djangopro ect.com/en/1.6/ref/settings/
>> > """
>> >
>> > # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
>> > import os
>> > BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>> >
>> >
>> > # Quick-start development settings - unsuitable for production
>> > # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
>> >
>> > # SECURITY WARNING: keep the secret key used in production secret!
>> > SECRET_KEY = '_p4ga=y!6rbqqv3&4)v7a*qtjb*8tedegd3=8#(p-2dl6a@3#v'
>> >
>> > # SECURITY WARNING: don't run with debug turned on in production!
>> > DEBUG = True
>> >
>> >
>> > ALLOWED_HOSTS = []
>> >
>> >
>> > # Application definition
>> >
>> > INSTALLED_APPS = (
>> > 'django.contrib.admin',
>> > 'django.contrib.auth',
>> > 'django.contrib.contenttypes',
>> > 'django.contrib.sessions',
>> > 'django.contrib.messages',
>> > 'django.contrib.staticfiles',
>> > 'main',
>> > 'tictactoe',
>> > )
>> >
>> > MIDDLEWARE_CLASSES = (
>> > 'django.contrib.sessions.middleware.SessionMiddleware',
>> > 'django.middleware.common.CommonMiddleware',
>> > 'django.middleware.csrf.CsrfViewMiddleware',
>> > 'django.contrib.auth.middleware.AuthenticationMiddleware',
>> > 'django.contrib.messages.middleware.MessageMiddleware',
>> > 'django.middleware.clickjacking.XFrameOptionsMiddleware',
>> > )
>> >
>> > ROOT_URLCONF = 'boardgames.urls'
>> >
>> > TEMPLATES = [
>> > {
>> > 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>> > 'DIRS': [os.path.join(BASE_DIR, 'templates')],
>> > 'APP_DIRS': True,
>> > 'OPTIONS': {
>> > 'context_processors': [
>> > 'django.core.context_processors.request',
>> > 'django.template.context_processors.debug',
>> > 'django.template.context_processors.request',
>> > 'django.contrib.auth.context_processors.auth',
>> > 'django.contrib.messages.context_processors.messages',
>> > ],
>> > },
>> > },
>> > ]
>> >
>> >
>> > WSGI_APPLICATION = 'boardgames.wsgi.application'
>> >
>> >
>> > # Database
>> > # https://docs.djangoproject.com/en/1.6/ref/settings/#databases
>> >
>> > DATABASES = {
>> > 'default': {
>> > 'ENGINE': 'django.db.backends.sqlite3',
>> > 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
>> > }
>> > }
>> >
>> > # Internationalization
>> > # https://docs.djangoproject.com/en/1.6/topics/i18n/
>> >
>> > LANGUAGE_CODE = 'en-us'
>> >
>> > TIME_ZONE = 'UTC'
>> >
>> > USE_I18N = True
>> >
>> > USE_L10N = True
>> >
>> > USE_TZ = True
>> >
>> >
>> > # Static files (CSS, JavaScript, Images)
>> > # https://docs.djangoproject.com/en/1.6/howto/static-files/
>> >
>> > STATIC_URL = '/static/'
>> > STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
>> >
>> > LOGIN_URL = 'boardgames_login'
>> > LOGOUT_URL = 'boardgames_logout'
>> > LOGIN_REDIRECT_URL = 'user_home'
>> >
>> > I am new to Django learning.
>> > Please let me know if more details are required.
>> > Regards
>> > Deepanshu
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to django-users...@googlegroups.com.
>> > To post to this group, send email to django...@googlegroups.com.
>> > Visit this group at 

Re: unhashable type: 'dict'

2016-03-15 Thread Deepanshu Sagar
yes, thank you for the prompt reply, I am using 

from django.contrib.auth import views as auth_views

I need to redirect my webpage to "board_games" main page when the user logs 
out. 
can you please direct me to the correct way to do that? 

Thanks in advance. 



On Tuesday, March 15, 2016 at 5:45:07 PM UTC+5:30, luisza14 wrote:

> You are correct, your problem is in logout url , because you need to pass 
> a function not a duct as second parameter.
>
> Are you using django auth views ?
>
>
>
> https://docs.djangoproject.com/en/1.9/topics/auth/default/#django.contrib.auth.logout
>
>
> El martes, 15 de marzo de 2016, Deepanshu Sagar  > escribió:
> > Hello,
> > i am getting below error while accessing http://localhost:8000/login/.
> > 
> 
> >
> > Below are the chaining codes.
> > boardgames\urls.py
> > 
> 
> > boardgames\templates\login.html
> > 
> 
> >
> > NOTE: before adding "
> >
> > url(r'^logout/', {'next_page': 'boardgames_home'}, 
> name='boardgames_logout')
> >
> > to boardgames\urls.py. the access was working fine.
> > below is the settings.py
> >
> > """
> > Django settings for boardgames project.
> >
> > For more information on this file, see
> > https://docs.djangoproject.com/en/1.6/topics/settings/
> >
> > For the full list of settings and their values, see
> > https://docs.djangopro ect.com/en/1.6/ref/settings/
> > """
> >
> > # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
> > import os
> > BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
> >
> >
> > # Quick-start development settings - unsuitable for production
> > # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
> >
> > # SECURITY WARNING: keep the secret key used in production secret!
> > SECRET_KEY = '_p4ga=y!6rbqqv3&4)v7a*qtjb*8tedegd3=8#(p-2dl6a@3#v'
> >
> > # SECURITY WARNING: don't run with debug turned on in production!
> > DEBUG = True
> >
> >
> > ALLOWED_HOSTS = []
> >
> >
> > # Application definition
> >
> > INSTALLED_APPS = (
> > 'django.contrib.admin',
> > 'django.contrib.auth',
> > 'django.contrib.contenttypes',
> > 'django.contrib.sessions',
> > 'django.contrib.messages',
> > 'django.contrib.staticfiles',
> > 'main',
> > 'tictactoe',
> > )
> >
> > MIDDLEWARE_CLASSES = (
> > 'django.contrib.sessions.middleware.SessionMiddleware',
> > 'django.middleware.common.CommonMiddleware',
> > 'django.middleware.csrf.CsrfViewMiddleware',
> > 'django.contrib.auth.middleware.AuthenticationMiddleware',
> > 'django.contrib.messages.middleware.MessageMiddleware',
> > 'django.middleware.clickjacking.XFrameOptionsMiddleware',
> > )
> >
> > ROOT_URLCONF = 'boardgames.urls'
> >
> > TEMPLATES = [
> > {
> > 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> > 'DIRS': [os.path.join(BASE_DIR, 'templates')],
> > 'APP_DIRS': True,
> > 'OPTIONS': {
> > 'context_processors': [
> > 'django.core.context_processors.request',
> > 'django.template.context_processors.debug',
> > 'django.template.context_processors.request',
> > 'django.contrib.auth.context_processors.auth',
> > 'django.contrib.messages.context_processors.messages',
> > ],
> > },
> > },
> > ]
> >
> >
> > WSGI_APPLICATION = 'boardgames.wsgi.application'
> >
> >
> > # Database
> > # https://docs.djangoproject.com/en/1.6/ref/settings/#databases
> >
> > DATABASES = {
> > 'default': {
> > 'ENGINE': 'django.db.backends.sqlite3',
> > 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
> > }
> > }
> >
> > # Internationalization
> > # https://docs.djangoproject.com/en/1.6/topics/i18n/
> >
> > LANGUAGE_CODE = 'en-us'
> >
> > TIME_ZONE = 'UTC'
> >
> > USE_I18N = True
> >
> > USE_L10N = True
> >
> > USE_TZ = True
> >
> >
> > # Static files (CSS, JavaScript, Images)
> > # https://docs.djangoproject.com/en/1.6/howto/static-files/
> >
> > STATIC_URL = '/static/'
> > STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
> >
> > LOGIN_URL = 'boardgames_login'
> > LOGOUT_URL = 'boardgames_logout'
> > LOGIN_REDIRECT_URL = 'user_home'
> >
> > I am new to Django learning.
> > Please let me know if more details are required.
> > Regards
> > Deepanshu
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users...@googlegroups.com .
> > To post to this group, send email to django...@googlegroups.com 
> .
> > Visit this group at https://groups.google.com/group/django-users.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/28da63f3-382c-4ff8-b698-79bc0b0d8b49%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> -- 
> "La utopía sirve para caminar" Fernando Birri
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 

Re: unhashable type: 'dict'

2016-03-15 Thread Luis Zárate
You are correct, your problem is in logout url , because you need to pass a
function not a duct as second parameter.

Are you using django auth views ?


https://docs.djangoproject.com/en/1.9/topics/auth/default/#django.contrib.auth.logout


El martes, 15 de marzo de 2016, Deepanshu Sagar 
escribió:
> Hello,
> i am getting below error while accessing http://localhost:8000/login/.
>

>
> Below are the chaining codes.
> boardgames\urls.py
>

> boardgames\templates\login.html
>

>
> NOTE: before adding "
>
> url(r'^logout/', {'next_page': 'boardgames_home'},
name='boardgames_logout')
>
> to boardgames\urls.py. the access was working fine.
> below is the settings.py
>
> """
> Django settings for boardgames project.
>
> For more information on this file, see
> https://docs.djangoproject.com/en/1.6/topics/settings/
>
> For the full list of settings and their values, see
> https://docs.djangopro ect.com/en/1.6/ref/settings/
> """
>
> # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
> import os
> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>
>
> # Quick-start development settings - unsuitable for production
> # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
>
> # SECURITY WARNING: keep the secret key used in production secret!
> SECRET_KEY = '_p4ga=y!6rbqqv3&4)v7a*qtjb*8tedegd3=8#(p-2dl6a@3#v'
>
> # SECURITY WARNING: don't run with debug turned on in production!
> DEBUG = True
>
>
> ALLOWED_HOSTS = []
>
>
> # Application definition
>
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'main',
> 'tictactoe',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
> )
>
> ROOT_URLCONF = 'boardgames.urls'
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': [os.path.join(BASE_DIR, 'templates')],
> 'APP_DIRS': True,
> 'OPTIONS': {
> 'context_processors': [
> 'django.core.context_processors.request',
> 'django.template.context_processors.debug',
> 'django.template.context_processors.request',
> 'django.contrib.auth.context_processors.auth',
> 'django.contrib.messages.context_processors.messages',
> ],
> },
> },
> ]
>
>
> WSGI_APPLICATION = 'boardgames.wsgi.application'
>
>
> # Database
> # https://docs.djangoproject.com/en/1.6/ref/settings/#databases
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.sqlite3',
> 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
> }
> }
>
> # Internationalization
> # https://docs.djangoproject.com/en/1.6/topics/i18n/
>
> LANGUAGE_CODE = 'en-us'
>
> TIME_ZONE = 'UTC'
>
> USE_I18N = True
>
> USE_L10N = True
>
> USE_TZ = True
>
>
> # Static files (CSS, JavaScript, Images)
> # https://docs.djangoproject.com/en/1.6/howto/static-files/
>
> STATIC_URL = '/static/'
> STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
>
> LOGIN_URL = 'boardgames_login'
> LOGOUT_URL = 'boardgames_logout'
> LOGIN_REDIRECT_URL = 'user_home'
>
> I am new to Django learning.
> Please let me know if more details are required.
> Regards
> Deepanshu
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/28da63f3-382c-4ff8-b698-79bc0b0d8b49%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
"La utopía sirve para caminar" Fernando Birri

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyPDxLVpu%2BAwM7z9gmEO5mLj5sNdrMEED0gDhwm3qpigsA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


unhashable type: 'dict'

2016-03-15 Thread Deepanshu Sagar
Hello, 

i am getting below error while accessing http://localhost:8000/login/.



Below are the chaining codes.

boardgames\urls.py


boardgames\templates\login.html



NOTE: before adding "

url(r'^logout/', {'next_page': 'boardgames_home'}, name='boardgames_logout')

to boardgames\urls.py. the access was working fine. 

below is the settings.py 

"""
Django settings for boardgames project.

For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/

For the full list of settings and their values, see
https://docs.djangopro ect.com/en/1.6/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '_p4ga=y!6rbqqv3&4)v7a*qtjb*8tedegd3=8#(p-2dl6a@3#v'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True


ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'main',
'tictactoe',
)

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'boardgames.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.core.context_processors.request',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]


WSGI_APPLICATION = 'boardgames.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/

STATIC_URL = '/static/'
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)

LOGIN_URL = 'boardgames_login'
LOGOUT_URL = 'boardgames_logout'
LOGIN_REDIRECT_URL = 'user_home'



I am new to Django learning. 

Please let me know if more details are required. 

Regards
Deepanshu

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/28da63f3-382c-4ff8-b698-79bc0b0d8b49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[SOLVED]: Caught TypeError while rendering: unhashable type: 'dict'

2010-07-26 Thread Colleen A Josephson
Sorry about the double e-mail, not sure what happened there.

I ended up fixing the issue myself; I wasn't fully understanding the structure 
of patterns() in urls.py.

I moved the 'SSL': True into the other dictionary so the line now looks like:

(r'^login/', 'django.contrib.auth.views.login', {'template_name': 'reg\
istration/login.html', 'SSL' : True}),


From: django-users@googlegroups.com [django-us...@googlegroups.com] On Behalf 
Of Colleen A Josephson [cjos...@mit.edu]
Sent: Monday, July 26, 2010 2:35 PM
To: django-users@googlegroups.com
Subject: Caught TypeError while rendering: unhashable type: 'dict'

I'm trying to use the SSLMiddleware.

I have a login page whose urlconf is:
(r'^login/', 'django.contrib.auth.views.login', {'template_name': 'reg\
istration/login.html'}, {'SSL' : True}),

When I go to that page, I get the error: TemplateSyntaxError at /login/

Caught TypeError while rendering: unhashable type: 'dict'

and it points to line 9 of my login.html template
1   {% extends "base.html" %}
2
3   {% block content %}
4
5   {% if form.errors %}
6   Your username and password didn't match. Please try again.
7   {% endif %}
8
9   {% csrf_token %}
10  
11  
12  {{ form.username.label_tag }}
13  {{ form.username }}
14  
15  
16  {{ form.password.label_tag }}
17  {{ form.password }}
18  
19  

If I omit the {'SSL' : True} option in urls.py, the page loads fine.

Any help is greatly appreciated.

-Colleen

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Caught TypeError while rendering: unhashable type: 'dict'

2010-07-26 Thread Colleen A Josephson
I'm trying to use the SSLMiddleware.

I have a login page whose urlconf is: 
(r'^login/', 'django.contrib.auth.views.login', {'template_name': 'reg\
istration/login.html'}, {'SSL' : True}),

When I go to that page, I get the error: TemplateSyntaxError at /login/

Caught TypeError while rendering: unhashable type: 'dict'

and it points to line 9 of my login.html template
1   {% extends "base.html" %}
2   
3   {% block content %}
4   
5   {% if form.errors %}
6   Your username and password didn't match. Please try again.
7   {% endif %}
8   
9   {% csrf_token %}
10  
11  
12  {{ form.username.label_tag }}
13  {{ form.username }}
14  
15  
16  {{ form.password.label_tag }}
17  {{ form.password }}
18  
19   

If I omit the {'SSL' : True} option in urls.py, the page loads fine.

Any help is greatly appreciated.

-Colleen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Caught TypeError while rendering: unhashable type: 'dict'

2010-07-26 Thread Colleen A Josephson
I'm trying to use the SSLMiddleware.

I have a login page whose urlconf is: 
(r'^login/', 'django.contrib.auth.views.login', {'template_name': 'reg\
istration/login.html'}, {'SSL' : True}),

When I go to that page, I get the error: TemplateSyntaxError at /login/

Caught TypeError while rendering: unhashable type: 'dict'

and it points to line 9 of my login.html template
1   {% extends "base.html" %}
2   
3   {% block content %}
4   
5   {% if form.errors %}
6   Your username and password didn't match. Please try again.
7   {% endif %}
8   
9   {% csrf_token %}
10  
11  
12  {{ form.username.label_tag }}
13  {{ form.username }}
14  
15  
16  {{ form.password.label_tag }}
17  {{ form.password }}
18  
19   

If I omit the {'SSL' : True} option in urls.py, the page loads fine.

Any help is greatly appreciated.

-Colleen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.