Question

I'm trying to create a form with only some fields to modify from the django user model, but when i try this code:

class UserEditForm(forms.ModelForm):
class meta:
    model = User
    fields = ['first_name', 'last_name',]

and i do:

user_db = User.objects.get(pk=u_id)
user_form = UserEditForm(instance=user_db)

i get an empty form. Any ideas?

Thank you!

Was it helpful?

Solution

thanks

The error is:

class Meta: 

with capital letter.

Thank you!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top