List Info

Thread: Class Methods in Model?




Class Methods in Model?
user name
2006-02-14 18:23:58
Hello,

I have a model called Invitation that I would like to have a
method
called make_rsvp_code.  In the model I define it as such:

class Invitation(meta.Model):
    [...]

    def make_rsvp_code(self, invitation):
        [...]
    make_rsvp_code = classmethod(make_rsvp_code)

The reason I pass in an invitation is because the RSVP code
is based
on some other fields within the  invitation object.

When I run:

invitations.make_rsvp_code(invitation)

I get this error:

AssertionError: 'make_rsvp_code' is an invalid model
parameter.

Is it possible to give a class classmethods in django?

Thanks!
-berto.
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )