Sunday, October 3, 2010

Re: Include form in template tag

Hey Anton

Thanks for this. I had the same problem and your "..forms" style
import statement solved it.

I'd love to get to the bottom of why this is necessary - something in
how tags are loaded I guess.

cheers, Oliver

On Sep 24, 12:41 am, Anton Danilchenko <anton.danilche...@gmail.com>
wrote:
> In my case this work well:
>
> from ..forms import MessageSearchForm
>
> Maybe we have other solution for this?
>
> On 23 сен, 16:46, Anton Danilchenko <anton.danilche...@gmail.com>
> wrote:
>
>
>
> > Hi!
>
> > I have created templatetag (used Django 1.2.3) in templatetags/
> > board.py file. I need import form class from application.
>
> > Structure of project is:
> > + board/
> > +++ views.py
> > +++ forms.py
> > +++ templatetags/
> > +++++ board.py
> > + ... some other project applications ...
>
> > How can I do import of form from the file forms.py?
>
> > I try to do this:
> > 1) from models import Message
> > 2) from board.models import Message
> > 3) from myprojectname.board.models import Message
>
> > All this not work and show error message like this: "'board' is not a
> > valid tag library: ImportError raised loading
> > board.templatetags.board: No module named models"
>
> > Please help.

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate