Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- models.py
- class Profile(models.Model):
- user = models.OneToOneField(User, on_delete=models.CASCADE, verbose_name='Пользователь', max_length=8)
- image = models.ImageField(upload_to='profile_pics', verbose_name='Аватарка')
- def __str__(self):
- return f'{self.user} Profile'
- form.py
- class ProfileForm(forms.ModelForm):
- class Meta:
- model = Profile
- fields = ['user', 'image']
- url.py
- path('profile/edit/', Profile_edit.as_view(), name='profile_edit'),
- views.py
- from.models import Profile
- class Profile_edit(UpdateView):
- model = Profile
- fields = ['user', 'image']
- form_class = ProfileForm
- template_name = 'signup/profile_edit.html'
- success_url = 'profile'
- error:AttributeError: Generic detail view Profile_edit must be called with either an object pk or a slug in the URLconf.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement