custmoizing admin using template files

2013-05-22 Thread Christopher Spears
Hi!

I am working through the Django tutorial, and I have reached the part where 
I want to customize my admin.  Basically,  I want 'Chris Spears App' to 
appear at the top of the page instead of 'Django administration'.

I copied the base_site.html file from its home to 
C:\Users\Chris\Documents\django_dev\mysite\templates\admin.

I then modified the file like so:

{% extends "admin/base.html" %}
{% load i18n %}

{% block title %}{{ title }} | {% trans 'Django site admin' %}{% endblock %}

{% block branding %}
{% trans 'Chris Spears App' %}
{% endblock %}

{% block nav-global %}{% endblock %}

I then modified the settings.py file:

import os

# Django settings for mysite project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

BASE_DIR = 'C:\Users\Chris\Documents\django_dev\mysite'
#BASE_DIR = os.path.dirname(os.path.dirname(__file__))

TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]

For some reason, I can't get the change to work.  I'm pretty sure that I am 
referencing the wrong file, but I can't figure out how to print the value 
of TEMPLATE_DIRS.  Any advice?

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




define BASE_DIR?

2013-05-21 Thread Christopher Spears
I am working my way through the Django tutorial, and I have reached the 
part where I am supposed to customize the look and feel of the admin.  I am 
supposed to do that using the mysite\settings.py file (working on a Windows 
laptop).  I have two questions.

At first, I just typed the following into the file:

TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]

I got an error message stating that os.path was not recognized.  I solved 
this by putting 'import os.path' at the top of the file.  Does this mean 
there is a bug in the tutorial's documentation?  I do not recall seeing any 
instructions that told me to add this.

After I solved the first problem, I now get this error message:

  File "C:\Users\Chris\Documents\django_dev\mysite\mysite\settings.py", 
line 7,
in 
TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
NameError: name 'BASE_DIR' is not defined

Am I supposed to now define BASE_DIR?

Thanks!

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




question about django tutorial

2013-04-30 Thread Christopher Spears
Hi!

I am a Django newbie, so please bear with me.  I am working on part 2 of 
the Django tutorial.

I started my server with the following:

python manage.py runserver


Then I logged into my admin site.

Earlier in the tutorial, I had created a model called Polls.  I selected 
Polls from the Site administration menu and then selected the 'What's up?' 
version of Polls to change.  However, when I clicked on the 'Save and 
Continue Editing' Button, I got this traceback:

Environment:


Request Method: POST
Request URL: http://127.0.0.1:8000/admin/polls/poll/1/

Django Version: 1.5.1
Python Version: 2.7.4
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'polls')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in 
get_response
  115. response = callback(request, *callback_args, 
**callback_kwargs)
File "C:\Python27\lib\site-packages\django\contrib\admin\options.py" in 
wrapper
  372. return self.admin_site.admin_view(view)(*args, 
**kwargs)
File "C:\Python27\lib\site-packages\django\utils\decorators.py" in 
_wrapped_view
  91. response = view_func(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\django\views\decorators\cache.py" in 
_wrapped_view_func
  89. response = view_func(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\django\contrib\admin\sites.py" in inner
  202. return view(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\django\utils\decorators.py" in _wrapper
  25. return bound_func(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\utils\decorators.py" in 
_wrapped_view
  91. response = view_func(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\django\utils\decorators.py" in 
bound_func
  21. return func(self, *args2, **kwargs2)
File "C:\Python27\lib\site-packages\django\db\transaction.py" in inner
  223. return func(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\contrib\admin\options.py" in 
change_view
  1108. self.log_change(request, new_object, change_message)
File "C:\Python27\lib\site-packages\django\contrib\admin\options.py" in 
log_change
  546. change_message  = message
File "C:\Python27\lib\site-packages\django\contrib\admin\models.py" in 
log_action
  19. e.save()
File "C:\Python27\lib\site-packages\django\db\models\base.py" in save
  546.force_update=force_update, 
update_fields=update_fields)
File "C:\Python27\lib\site-packages\django\db\models\base.py" in save_base
  650. result = manager._insert([self], fields=fields, 
return_id=update_pk, using=using, raw=raw)
File "C:\Python27\lib\site-packages\django\db\models\manager.py" in _insert
  215. return insert_query(self.model, objs, fields, **kwargs)
File "C:\Python27\lib\site-packages\django\db\models\query.py" in 
insert_query
  1661. return query.get_compiler(using=using).execute_sql(return_id)
File "C:\Python27\lib\site-packages\django\db\models\sql\compiler.py" in 
execute_sql
  937. cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django\db\backends\util.py" in execute
  41. return self.cursor.execute(sql, params)
File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py" in 
execute
  366. six.reraise(utils.DatabaseError, 
utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
File "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py" in 
execute
  362. return Database.Cursor.execute(self, query, params)

Exception Type: DatabaseError at /admin/polls/poll/1/
Exception Value: no such table: django_admin_log

Was I supposed to set up this table earlier in the tutorial?  When I went 
back in the tutorial, I didn't see any mention of it.  I am working on a 
Windows laptop.

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.