Fix Python – DateTimeField doesn’t show in admin system

How come my “date” field doesn’t come up in the admin system?
In my admin.py file i have
from django.contrib import admin
from glasses.players.models import *
admin.site.register(Rating)

and the Rating model has a field called “date” which looks like this
date = models.DateTimeField(editable=True, auto_now_add=True)

However within the admin syst….

Fix Python – How to reload modules in django shell?

I am working with Django and use Django shell all the time. The annoying part is that while the Django server reloads on code changes, the shell does not, so every time I make a change to a method I am testing, I need to quit the shell and restart it, re-import all the modules I need, reinitialize all the variables I need etc. While iPython histor….

Fix Python – How to create a user in Django?

I’m trying to create a new User in a Django project by the following code, but the highlighted line fires an exception.
def createUser(request):
userName = request.REQUEST.get(‘username’, None)
userPass = request.REQUEST.get(‘password’, None)
userMail = request.REQUEST.get(’email’, None)

# TODO: check if already existed

**use….

Fix Python – How to properly use the “choices” field option in Django

I’m reading the tutorial here: https://docs.djangoproject.com/en/1.5/ref/models/fields/#choices
and i’m trying to create a box where the user can select the month he was born in. What I tried was
MONTH_CHOICES = (
(JANUARY, “January”),
(FEBRUARY, “February”),
(MARCH, “March”),
….
(DECEMBER, “December”),
)

month = CharField(….

Fix Python – What’s the difference between ContentType and MimeType?

As far as I know, they are absolute equal. However, browsing some django docs, I’ve
found this piece of code:
HttpResponse.__init__(content=”, mimetype=None, status=200, content_type=’text/html’)
which surprise me the two getting along each other. The official docs was able to solve the issue in a practical manner:

content_type is an alias for m….