friendsmap/map/forms.py

24 lines
536 B
Python
Raw Normal View History

2019-03-02 17:39:53 +01:00
from django import forms
from map.models import FriendLocation
class LocationForm(forms.ModelForm):
class Meta:
model = FriendLocation
fields = [
'latitude',
'longitude',
'start_date',
'end_date',
'friend',
]
widgets = {'friend': forms.HiddenInput()}
def __init__(self, request, *args, **kwargs):
super().__init__(*args, **kwargs)
self.request = request
def clean_friend(self):
return self.request.user