lostplaces-backend/lostplaces/lostplaces_app/forms.py
2020-07-30 13:09:00 +02:00

30 lines
818 B
Python

from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from .models import Explorer, Place, PlaceImage
class ExplorerCreationForm(UserCreationForm):
class Meta:
model = Explorer
fields = ('username', 'email')
class ExplorerChangeForm(UserChangeForm):
class Meta:
model = Explorer
fields = ('username', 'email')
class PlaceForm(forms.ModelForm):
class Meta:
model = Place
fields = '__all__'
exclude = ['submitted_by']
class PlaceImageCreateForm(forms.ModelForm):
class Meta:
model = PlaceImage
fields = '__all__'
exclude = ['submitted_by', 'place', 'description']
widgets = {
'filename': forms.ClearableFileInput(attrs={'multiple': True})
}