Ticket #4694: get_form_field.diff

File get_form_field.diff, 655 bytes (added by vsevolod.solovyov@…, 17 years ago)
  • django/db/models/base.py

     
    417417            setattr(self, cachename, get_image_dimensions(filename))
    418418        return getattr(self, cachename)
    419419
     420    def get_form_field(cls, name, **kwargs):
     421        return (f for f in cls._meta.fields if f.name == name).next().formfield(**kwargs)
     422    get_form_field = classmethod(get_form_field)
     423
    420424############################################
    421425# HELPER FUNCTIONS (CURRIED MODEL METHODS) #
    422426############################################
Back to Top