feat: Add user to AN automatically

This commit is contained in:
moanos [he/him] 2024-06-08 11:43:55 +02:00
parent 8980cc263b
commit a1b287641d

View File

@ -118,10 +118,9 @@ def add_adoption_notice(request):
form = AdoptionNoticeForm(request.POST, request.FILES, in_adoption_notice_creation_flow=True) form = AdoptionNoticeForm(request.POST, request.FILES, in_adoption_notice_creation_flow=True)
if form.is_valid(): if form.is_valid():
instance = form.save() instance = form.save(commit=False)
instance.created_by = request.user
"""Search the location given in the location string and add it to the adoption notice""" """Search the location given in the location string and add it to the adoption notice"""
geo_api = GeoAPI()
location = Location.get_location_from_string(instance.location_string) location = Location.get_location_from_string(instance.location_string)
instance.location = location instance.location = location
instance.save() instance.save()