Wednesday, March 2, 2011

Re: urls.py usage

Thank you very much!!! It works!
I followed "Python Web Development with Django. J.Forcier, P.Bissex,
W.Chun" (I used russian edition). They instruct readers to include
registration statement in model.py:
Chapter 2 (my reverse translation from russian into English): Open
file mysite/blog/models.py, add admin application import statement and
then add in the end of file your model registration statement.
from django.db import models
from django.contrib import admin
class BlogPost(models.Model):
title = models.CarField(max_length=150)
body=models.TextField()
timestamp=models.DateTimeField()
admin.site.register(BlogPost)

Later they develop this model: Add to your file mysite/blog/models.py
a new class BlogPostAdmin and add this name to registration method
call:
class BlogPostAdmin(admin.ModelAdmin):
list_display = ('title', 'timestamp')
admin.site.register(BlogPost, BlogPostAdmin)

In other projects they instruct us similarly. No admin.py files!

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

No comments:

Post a Comment