문제

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!

도움이 되었습니까?

해결책

thanks

The error is:

class Meta: 

with capital letter.

Thank you!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top