On Tuesday 14 February 2006 10:23, Roberto Aguilar wrote:
> 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.

Hey Berto,

<http://www.djangoproject.com/documentation/model_api/#module-level-methods>

Eric.

Reply via email to