Hi!
I working whit the book Practical Django Project and have a problem
with th weblog example.

(I have Django revision 8511.

I got the following error when I try to add an entry:
---------------------------------------------------
TypeError at /admin/coltrane/entry/add/

'module' object is not callable

Request Method:         POST
Request URL:    http://127.0.0.1:8000/admin/coltrane/entry/add/
Exception Type:         TypeError
Exception Value:

'module' object is not callable

Exception Location:     /home/markku/django/practical_djproj/coltrane/
models.py in save, line 76
Python Executable:      /usr/bin/python
Python Version:         2.5.2
---------------------------------------------------

copy of my models.py (error line 76 is marked):

---------------------------------------------------
import datetime
from django.db import models
from django.contrib.auth.models import User
from django.contrib import admin
from markdown import markdown
from tagging.fields import TagField

class Category(models.Model):
    description = models.TextField()
    slug = models.SlugField(unique=True, help_text="Must be unique")

    title = models.CharField(max_length=250, help_text='Max 250
chars')

    class Meta:
        ordering = ['title']
        verbose_name_plural = "Categories"

    def __unicode__(self):
        return self.title

    def get_absolute_url(self):
        return "/categories/%s/" % self.slug

class CategoryAdmin(admin.ModelAdmin):
    prepopulated_fields = {'slug': ('title',)}

admin.site.register(Category, CategoryAdmin)

class Entry(models.Model):

    LIVE_STATUS = 1
    DRAFT_STATUS = 2
    HIDDEN_STATUS = 3
    STATUS_CHOICES = (
        (LIVE_STATUS, 'Live'),
        (DRAFT_STATUS, 'Draft'),
        (HIDDEN_STATUS, 'Hidden'),
    )

    # Core fields
    title = models.CharField(max_length=250, help_text="Max 250
chars")
    excerpt = models.TextField(blank=True, help_text="Short sum.
Optional")

    body = models.TextField()
    pub_date = models.DateTimeField(default=datetime.datetime.now)

    # Fields to store genereted HTML
    body_html = models.TextField(editable=False, blank=True)
    excerp_html = models.TextField(editable=False, blank=True)

    # Metadata
    author = models.ForeignKey(User)
    enable_comments = models.BooleanField(default=True)
    featured = models.BooleanField(default=False)
    slug = models.SlugField(unique_for_date='pub_date',
help_text="Auto")
    status = models.IntegerField(choices=STATUS_CHOICES,
                                 default=LIVE_STATUS,
                                 help_text="Only LIVE will be
pub.displayed")

    # Categorization
    categories = models.ManyToManyField(Category)
    tags = TagField(help_text="Separate tags with spaces")

    class Meta:
        ordering = ['-pub_date']
        verbose_name_plural = "Entries"

    def __unicode__(self):
        return self.title

    def save(self):
        self.body_html = markdown(self.body)     <-- LINE 76 ERROR
        if self.excerpt:
            self.excerpt_html = markdown(self.excerpt)
        super(Entry, self).save()

    def get_absolute_url(self):
        return "/weblog/%s/%s/" % (self.pub_date.strftime("%Y/%b/
%d").lower(),
                                   self.slug)

class EntryAdmin(admin.ModelAdmin):
    prepopulated_fields = {'slug': ('title',)}

admin.site.register(Entry, EntryAdmin)
---------------------------------------------------------------------

Do anybody know what the problem is?


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to