Closed 2ynn closed 3 years ago
Hi, I've created a new Pick on my local instance, set it "Date-scheduled", open another browser, go to the calendar, and when I clicked "send" on the request for participation, I got this error:
Saskatoon version: bc11ac4
Environment:
Request Method: POST
Request URL: http://localhost:8000/participation/create?hid=2
Django Version: 3.2
Python Version: 3.8.10
Installed Applications:
['dal',
'dal_select2',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'ckeditor',
'leaflet',
'sitebase',
'member',
'harvest',
'rest_framework',
'django_filters',
'crispy_forms']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/Users/tristan/Documents/saskatoon-ng/ve/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/Users/tristan/Documents/saskatoon-ng/ve/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/tristan/Documents/saskatoon-ng/ve/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/Users/tristan/Documents/saskatoon-ng/ve/lib/python3.8/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/Users/tristan/Documents/saskatoon-ng/ve/lib/python3.8/site-packages/django/views/generic/edit.py", line 172, in post
return super().post(request, *args, **kwargs)
File "/Users/tristan/Documents/saskatoon-ng/ve/lib/python3.8/site-packages/django/views/generic/edit.py", line 142, in post
return self.form_valid(form)
File "/Users/tristan/Documents/saskatoon-ng/ve/lib/python3.8/site-packages/django/contrib/messages/views.py", line 11, in form_valid
response = super().form_valid(form)
File "/Users/tristan/Documents/saskatoon-ng/ve/lib/python3.8/site-packages/django/views/generic/edit.py", line 125, in form_valid
self.object = form.save()
File "/Users/tristan/Documents/saskatoon-ng/saskatoon/harvest/forms.py", line 112, in save
pick_leader_name = harvest_obj.pick_leader.person.first_name
Exception Type: AttributeError at /participation/create
Exception Value: 'NoneType' object has no attribute 'first_name'
@tristanlatr thanks for your feedback, I'll look into it!
@tristanlatr were you able to select a pick-leader when you created your new harvest?
were you able to select a pick-leader when you created your new harvest?
Yes
@tristanlatr I get the same error as you if and only if I don't set a pickleader, which makes sense. I opened new Issue #97
My issue was different. Once I have successfully added a participation request I am trying to edit it (pencil button on the harvest details page ). This is where I get the Sorry, this harvest is not open for requests. You can check the calendar for other harvests.
message. I'll dig further into this.
Ok, I start to wonder if these edit picker request pencils in harvest page should be here in the first place as there is no participation_update.html
template that would prefill data for an existing participation request.
The RequestForParticipationUpdateView
in harvest/api.py
does not pass any data along the form so harvest
object is empty and harvest.is_open_to_requests
is False
in participation_create.html
, thus the error message, which makes sense.
Should I create a new participation_update.html
template?
I am confused, how does the pick leader accepts a pending participation request?
Here is an extract of the guide, available here: https://github.com/LesFruitsDefendus/guides/blob/master/EN%20Pre-Pick%20Guide%202019.pdf
You can browser the complete set of guides from this repo: https://github.com/LesFruitsDefendus/guides
I don't think the core made any changes since the 2019 version.
Ok got it, we want something like this:
Thanks!
See new RFPManageForm / template in commit 0a517a004ae5f4e4201cc6fb1842ae6e48a74d08
Closing this for now, I will edit this form depending on the decision taken about showed_up
field in issue #98
I get alert message "Sorry, this harvest is not open for requests" when trying to update a request for participation: e.g.
http://localhost:8000/participation/update/1/
meaning{% harvest.is_open_to_requests == False %}
inparticipation_create.html
harvest.status
is set to "Date-scheduled"harvest.is_publishable
returns Trueharvest.is_open_to_requests
actually returns TrueI believe {{ harvest }} object doesn't actually gets passed to the form, it looks empty.
Could you please try and reproduce this issue ? Thanks!