broken default view of the django admin site
Hello, I'm very new to django. I just set up my first site using apache and mod_wsgi. The admin area does not seem to have the nice, neat blue default theme...its horrifically ugly and difficult to navigate. Here's a screenshot of the login area: http://web.mit.edu/~cjoseph/Public/fugly.png Below is an excerpt of my settings.py. Do I need to set something in TEMPLATE_DIRS for Django to use the default themes? # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'pssDjango.SSLredirect.SSLRedirect', ) ROOT_URLCONF = 'pssDjango.urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/djangplates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'pssDjango.polls', # Uncomment the next line to enable the admin: 'django.contrib.admin', ) #secure cookies SESSION_COOKIE_SECURE = True Thanks for any help, -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.
Viewing user profile fields in the admin
I have a user profile to collect and store additional information about my users. I would like to be able to view (and sort by) these attributes when I look at a list of my users in the admin. With the way my admin.py is written now, I can see the addition attributes when I create/modify an individual user, but the attribute is absent when I am looking at the list. my admin.py: from django.contrib import admin from django.contrib.auth.models import User from django.contrib.auth.admin import UserAdmin from pssDjango.accounts.models import PSSUser admin.site.unregister(User) class UserProfileInline(admin.StackedInline): model = PSSUser class UserProfileAdmin(UserAdmin): inlines = [UserProfileInline] admin.site.register(User, UserProfileAdmin) Any suggestions? Thanks, -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'
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'
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.
[SOLVED]: Caught TypeError while rendering: unhashable type: 'dict'
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.
RE: User Registration: Looking for tips
Actually, just yesterday I extended the django-registration form to deal with my profile @ registration time For reference I used: http://dmitko.ru/?p=546 and the link you previously posted, http://dewful.com/?p=70 It didn't require much code. The hardest part was sifting through some of the older irrelevant documentation in order to find instructions that worked. -Colleen From: django-users@googlegroups.com [django-us...@googlegroups.com] On Behalf Of strayhand [tobyb...@gmail.com] Sent: Thursday, July 29, 2010 11:13 AM To: Django users Subject: Re: User Registration: Looking for tips Euan, Thank you for the response. I agree with what you're saying and it seems that I have two options before me. 1. Define simple form class for my registration process. Write a save method that posts to both the "User" model and the "UserProfile" model. I could start this process from scratch but I came across this post that I'm interested in. Have you by chance looked at any of the work James Bennett (http://www.b-list.org/) has done with registration? He has essentially taken the UserCreationForm as a guide and reworked it to save the form to two models. In this example he's storing activation key in the UserProfile model. http://www.b-list.org/weblog/2006/sep/02/django-tips-user-registration/ I think that I could use what he's demonstrating here and add my own fields. What are your thoughts on this code? There are a few comments below his post that I'll need to keep in mind. My main concern is how old the post is. I don't want to waste a lot of time with this approach only to find out that Django has gone in a different direction. 2. The second option would be to try the django-registration module and make some tweaks. Do you (or anyone else out there) have any experience with this module? http://bitbucket.org/ubernostrum/django-registration/overview Seems like this would get me up and running with a registration system a little more advanced than I currently have but it would still need to be tweaked to include all of my profile fields. Here's a blog post about tweaking the django-registration form by extending the class: http://dewful.com/?p=70 Please let me know if you guys have opinions one way or another about these two approaches. Thank you. On Jul 28, 11:47 pm, "euan.godd...@googlemail.com" wrote: > For the UserProfle model you've provided you won't be able to user > the UserCreationForm as there are a load of extra fields. Moreover > because User is a foreign key from that model it isn't a straight- > forward matter of using a model form. To get a single model form to > split the work to two underlying models would be a fair bit of work. > > Although ModelForm is great, if you want to do things which are a bit > off what they were intended to do I'd use a simple Form and create a > custom save method that writes out the data to the two models. That's > how we do our registration process since we create at least 6 model > instances at join time. > > Euan > > On 29 July, 06:45, strayhand wrote: > > > I'm using the auth module for my project and I've got a registration > > form that's based on the "UserCreationForm" provided by > > "django.contrib.auth.forms" but it's only showing the username and > > password fields. > > > I want a registration process that requires users to fill out ALL of > > the "User" fields plus the fields in my "UserProfile" model. > > > If someone has some basic suggestions for how to modify the > > UserCreationForm to include these additional fields I'm all ears. I > > managed to find some basic examples of how to hide certain ModelForm > > fields or change their labels but nothing about adding additional > > fields, particularly from other models. > > > In addition to modifying the UserCreationForm I've come across a > > couple of leads: > > > 1. Build my own registration process following this example: > > >http://www.b-list.org/weblog/2006/sep/02/django-tips-user-registration/ > > > I'm concerned with how old this post is. Is this approach still valid > > given that it was posted in 2006? The author is using both the User > > model and his own UserProfile model. I think that I could adapt this > > for my purpose. > > > 2. Use the django-registration package provided by the same author > > >http://bitbucket.org/ubernostrum/django-registration/overview > > > I'm concerned with having to install additional packages into Django. > > It seems like this will make deploying my application on a Web host > > more difficult. Can anyone speak to this? > > > Thank you for your suggestions. I've provided my code thus far below. > > > # forms.py > > > from django import forms > > from django.contrib.auth.forms import UserCreationForm > > from django.http import HttpResponseRedirect > > from django.shortcuts import render_to_response > > from django.template import RequestContext > > > def register(request): > > if request.metho
SSL with Django, Apache, mod_wsgi and nginx
I just set up a site that uses nginx to server static media and Apache/mod_wsgi to deal with the Django stuff. How would I go about dealing with SSL? Would the setup be on the nginx end or the Apache end? Could I still use SSLRedirect middleware? Thanks, -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.
SSL with Django, Apache, mod_wsgi and nginx
I just set up a site that uses nginx to server static media and Apache/mod_wsgi to deal with the Django stuff. How would I go about dealing with SSL? Would the setup be on the nginx end or the Apache end? Could I still use SSLRedirect middleware? Thanks, -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.
RE: SSL with Django, Apache, mod_wsgi and nginx
Unfortunately I'm not very well versed in proxying and SSL, etc. I'm not sure I understand how mod WSGi eliminates the need for SSLRedirect. I implemented the Lincoln Loop setup, but if I go to the http:// admin page I am not redirected to https:// as I would like to be. From: django-users@googlegroups.com [django-us...@googlegroups.com] On Behalf Of Michael [newmani...@gmail.com] Sent: Tuesday, August 10, 2010 3:00 PM To: django-users@googlegroups.com Subject: Re: SSL with Django, Apache, mod_wsgi and nginx On Tue, Aug 10, 2010 at 2:49 PM, Colleen A Josephson mailto:cjos...@mit.edu>> wrote: I just set up a site that uses nginx to server static media and Apache/mod_wsgi to deal with the Django stuff. How would I go about dealing with SSL? Would the setup be on the nginx end or the Apache end? Could I still use SSLRedirect middleware? Thanks, -Colleen There isn't really much of a need for SSLRedirect Middleware with WSGi any more. This setup is really a nice one IMO. Thanks to Lincoln Loop for putting it up: http://lincolnloop.com/django-best-practices/deployment/servers.html Hope that helps, Michael -- 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.
RE: SSL with Django, Apache, mod_wsgi and nginx
That does exactly what I need, thank-you! From: django-users@googlegroups.com [django-us...@googlegroups.com] On Behalf Of Michael [newmani...@gmail.com] Sent: Tuesday, August 10, 2010 5:25 PM To: django-users@googlegroups.com Subject: Re: SSL with Django, Apache, mod_wsgi and nginx On Tue, Aug 10, 2010 at 5:00 PM, Colleen A Josephson mailto:cjos...@mit.edu>> wrote: Unfortunately I'm not very well versed in proxying and SSL, etc. I'm not sure I understand how mod WSGi eliminates the need for SSLRedirect. I implemented the Lincoln Loop setup, but if I go to the http:// admin page I am not redirected to https:// as I would like to be. It would be much more efficient to redirect from nginx than django here. Just implement something like this on your server that runs on port 80 (http): location /admin/ { rewrite (.*) https://$server_name$1 permanant; } This is just a snippit I just wrote. Let me know if it doesn't work, I will actually go and run it. hope that helps, Michael -- 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.