Função Django para criar forma para um objeto modelo

def create_form(type, id):
"""
Create the form for the object beeing edited.

"""

inner_model
= get_model('<your app>', type)
instance
= inner_model.objects.get(pk=id)

class MetaForm(ModelForm):
class Meta:
model
= inner_model

form
= MetaForm(instance=instance)
return form