$ python manage.py validate

checks whether the models’ syntax and logic are correct or not.

A project is an instance of a set of Django apps.

The project is associated with a setting file (settings.py).

$ python manage.py shell

enables the Python interpreter to run with the correct Django settings.

Execute it under your project directory where

settings.py

exists.

Do not use the same path for

MEDIA_URL

and

ADMIN_MEDIA_PREFIX

———

e.g.,

MEDIA_URL = ‘/media/’

ADMIN_MEDIA_PREFIX = ‘/media/’

This will not work.

If you got the above error,

check if ‘templatetags’ directory has

__init__.py file or not.

Use

object_list.count

———-

e.g.,

{%if not bookmark_list.count %}
<h2> There is no post in your bookmark.</h2>
{%endif%}

You may see

pass

in some admin.py files.

The pass statement tells that we don’t want to customize anything in this subclass.

Download django tar.gz file (1.0.2 final)

untar

> python setup.py install

> copy /django/bin/django-admin.py to some system path, e.g., c:\python25\

After you created your models, you need to tell django to use it.

To let django know that, you need to add your model name at INSTALLED_APPS in settings.py.

e.g.,

———

INSTALLED_APPS = (
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.sites’,
‘django.contrib.admin’,
‘myblogsite.myblogapp’,
)

Model

maps to a single database table.

Model

is about your data.

Model contains

1. fields

2. methods

Model is similar to the concept of class in other object-oriented programming.

© 2011 Web Oom Suffusion theme by Sayontan Sinha
Switch to our mobile site
Page 3 of 5«12345»Top Footer