diff --git a/django_lostplaces/lostplaces/forms.py b/django_lostplaces/lostplaces/forms.py index 89a95ab..491bcd0 100644 --- a/django_lostplaces/lostplaces/forms.py +++ b/django_lostplaces/lostplaces/forms.py @@ -35,7 +35,19 @@ class SignupVoucherForm(UserCreationForm): fetched_voucher.delete() return True -class ProfileChangeForm(forms.ModelForm): +class ExplorerUserChangeForm(UserChangeForm): + class Meta: + model = User + fields = [ 'username', 'first_name', 'last_name', 'email' ] + password = None + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.fields['username'].required = False + self.fields['username'].help_text = None + self.fields['username'].widget.attrs['disabled'] = 'disabled' + +class ExplorerChangeForm(forms.ModelForm): class Meta: model = Explorer fields = '__all__' diff --git a/django_lostplaces/lostplaces/templates/explorer/profile_update.html b/django_lostplaces/lostplaces/templates/explorer/profile_update.html new file mode 100644 index 0000000..0da5ec8 --- /dev/null +++ b/django_lostplaces/lostplaces/templates/explorer/profile_update.html @@ -0,0 +1,55 @@ +{% extends 'global.html'%} +{% load static %} +{% load i18n %} +{% load widget_tweaks %} + +# {% block title %}{% trans 'Edit Explorer profile' %}{% endblock %} + +{% block maincontent %} + +
+ +{% endblock maincontent %} diff --git a/django_lostplaces/lostplaces/urls.py b/django_lostplaces/lostplaces/urls.py index 0e38282..bcfb646 100644 --- a/django_lostplaces/lostplaces/urls.py +++ b/django_lostplaces/lostplaces/urls.py @@ -18,7 +18,8 @@ from lostplaces.views import ( PlaceImageCreateView, PlaceImageDeleteView, FlatView, - ExplorerProfileView + ExplorerProfileView, + ExplorerProfileUpdateView ) urlpatterns = [ @@ -39,9 +40,8 @@ urlpatterns = [ path('place/tag/delete/