I am working on a problem where I need to update some fields of user model with one field of the model in which it is inherited. Using updateview with that model shows errors. How am I supposed to do it? thanks in advance.
models.py
class UserProfile(models.Model):
user = models.OneToOneField(User,on_delete=models.CASCADE, default=None, null=True)
role = models.CharField(max_length=50, choices=Roles)
verified =models.BooleanField(default = False,blank=True)
photo = models.ImageField(upload_to='images', blank=True, default='default/testimonial2.jpg')
def __str__(self):
return self.user.username
views.py
class UserUpdateView(UpdateView):
fields = ('first_name','last_name','email','photo')
model = UserProfile
success_url = reverse_lazy("NewApp:logindex")