Commit 4e566f82 by Yvon Kerdoncuff

remove unused method home in shifts/views.py

parent 629f108f
......@@ -6,7 +6,6 @@ from . import views
urlpatterns = [
url(r'^index/(?P<partner_id>\d+)/(?P<hashed_date>[a-z0-9]+)$', views.home),
url(r'^get_list_shift_calendar/(?P<partner_id>\d+)/?$', views.get_list_shift_calendar),
url(r'^get_list_shift_partner/(?P<partner_id>\d+)/?$', views.get_list_shift_partner),
......
......@@ -11,61 +11,6 @@ state_shift_allowed = ["up_to_date", "alert", "delay"]
tz = pytz.timezone("Europe/Paris")
def home(request, partner_id, hashed_date):
import hashlib
cs = CagetteShift()
partnerData = cs.get_data_partner(partner_id)
md5_calc = hashlib.md5(partnerData['create_date'].encode('utf-8')).hexdigest()
if (md5_calc == hashed_date):
# if not request.session.get('odoo_token', False):
# import uuid
#  request.session['odoo_token'] = uuid.uuid4().hex
# request.session.modified = True
# Ne fonctionne pas !!! Les données de sessions sont perdues à la connexion suivante (ajax : voir cross domain cookies
if len(partnerData) > 0:
partnerData['verif_token'] = md5_calc
if len(partnerData['leave_ids']) > 0:
listLeave = cs.get_leave(int(partner_id))
if len(listLeave) > 0:
partnerData["is_leave"] = True
partnerData["leave_start_date"] = listLeave[0]["start_date"]
partnerData["leave_stop_date"] = listLeave[0]["stop_date"]
if partnerData['cooperative_state'] in state_shift_allowed:
# domain = "127.0.0.1"
domain = getattr(settings, 'EMAIL_DOMAIN', 'lacagette-coop.fr')
days_to_hide = "0"
if hasattr(settings, 'SHIFT_EXCHANGE_DAYS_TO_HIDE'):
days_to_hide = settings.SHIFT_EXCHANGE_DAYS_TO_HIDE
context = {'title': 'Calendrier', "partnerData": partnerData,
'daysToHide': days_to_hide,
'SHIFT_INFO': settings.SHIFT_INFO,
'PB_INSTRUCTIONS': settings.PB_INSTRUCTIONS,
'domain': domain}
context['ADDITIONAL_INFO_SHIFT_PAGE'] = getattr(settings, 'ADDITIONAL_INFO_SHIFT_PAGE', '')
if hasattr(settings, 'CALENDAR_NO_MORE_LINK'):
if settings.CALENDAR_NO_MORE_LINK is True:
context['calendarEventNoMoreLinks'] = True
if hasattr(settings, 'CAL_INITIAL_VIEW'):
context['calInitialView'] = settings.CAL_INITIAL_VIEW
# No effect with 3.9 version : TODO upgrade fullCalendar lib
# Needs init calendar rewriting
response = render(request, 'shifts/shift_exchange.html', context)
else:
context = {'title': 'Invitation', "partnerData": partnerData}
if hasattr(settings, 'UNSUBSCRIBED_MSG'):
context['UNSUBSCRIBED_MSG'] = settings.UNSUBSCRIBED_MSG
response = render(request, 'shifts/shift_states_not_allowed.html', context)
# response.set_cookie('odoo_token', request.session.get('odoo_token', False) )
return response
else:
return HttpResponseNotFound('<h1>Nothing to show !</h1>')
else:
return HttpResponseForbidden()
def _is_middled_filled_considered(reserved, max):
"""Added to fit with new LaCagette need. (based on num rather than %)."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment