From 53f89caef58a261a362c74d23498946df41d5e02 Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Thu, 24 Dec 2020 20:31:52 +0100 Subject: [PATCH] Added a ModelForm to change profile details. --- django_lostplaces/lostplaces/forms.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/django_lostplaces/lostplaces/forms.py b/django_lostplaces/lostplaces/forms.py index 9e622b2..89a95ab 100644 --- a/django_lostplaces/lostplaces/forms.py +++ b/django_lostplaces/lostplaces/forms.py @@ -8,7 +8,7 @@ from django.db import models from django.contrib.auth.forms import UserCreationForm, UserChangeForm from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ -from lostplaces.models import Place, PlaceImage, Voucher +from lostplaces.models import Place, PlaceImage, Voucher, Explorer class SignupVoucherForm(UserCreationForm): class Meta: @@ -35,6 +35,12 @@ class SignupVoucherForm(UserCreationForm): fetched_voucher.delete() return True +class ProfileChangeForm(forms.ModelForm): + class Meta: + model = Explorer + fields = '__all__' + exclude = ['user', 'favorite_places'] + class PlaceForm(forms.ModelForm): class Meta: model = Place