Frage

I'm trying to figure out how Askbot Django-based forum works like and I came across a mystery that I can't seem to solve (newbie):

in this file:

https://github.com/ASKBOT/askbot-devel/blob/master/askbot/views/writers.py

there's this code:

            question = user.post_question(
                title=title,
                body_text=text,
                tags=tagnames,
                wiki=wiki,
                is_anonymous=ask_anonymously,
                is_private=post_privately,
                timestamp=timestamp,
                group_id=group_id,
                language=language)

The thing is, tracking down 'user' object I guess it is a 'User' object type added by 'Authentication Middleware' to the 'HttpRequest' object as an attribute.

My question is: where in the whole Django / Askbot code is 'post_question()' defined as a 'User' object method??

I have searched across Django and Askbot documentation and code, and I give up!

Many thanks,

for more information: Askbot in Github.

War es hilfreich?

Lösung

Askbot is adding the method to the User class. Here's the line that does it. And here's the definition of the method.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top