En/na marsii ha escrit:
> 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):
>
> --------------------------------------------------
>
I have the same code, I think..., and I doesn't get that error.
Try to put comments in the whole method save() or in the line 76 so that
we can see where is the problem...
Cheers...
En/na marsii ha escrit:
> excerp_html = models.TextField(editable=False, blank=True)
>
_____
↓
excerpt_html = models.TextField(editable=False, blank=True)
You have only that mistake in the code you've attached...
Your models.py works on my system.
Cheers...
> from markdown import markdown
[...]
> self.body_html = markdown(self.body) <-- LINE 76 ERROR
The imported name 'markdown' should be a function, yet python thinks
it's a module. What is it?
Try importing markdown and running the above snippet outside of django
in a python shell. Does that work?
Regards,
Christian
--
Christian Joergensen
http://www.technobabble.dk
I'll bet money that you have this:
import markdown
When the book tells you to do this:
from markdown import markdown
There's a very important difference.
--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."