문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top