Update documentation
This commit is contained in:
parent
7540f4f18a
commit
a188d48c89
@ -15,6 +15,7 @@ Here you can read more information about the Poliklinieken Planning Tool.
|
||||
|
||||
install
|
||||
models
|
||||
views
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
6
doc/views.rst
Normal file
6
doc/views.rst
Normal file
@ -0,0 +1,6 @@
|
||||
======
|
||||
Vieuws
|
||||
======
|
||||
|
||||
.. automodule:: apps.schedule.views
|
||||
:members:
|
@ -23,6 +23,8 @@ class Schedule(MetaDataModel):
|
||||
The email address where the results should be sent to. Max length is 100 characters.
|
||||
status : ScheduleStatus
|
||||
The status of the schedule.
|
||||
planning_source : JSON
|
||||
The complete schedule stored in JSON data object.
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
|
@ -6,7 +6,5 @@ app_name = 'schedule'
|
||||
urlpatterns = [
|
||||
path('', views.ScheduleListView.as_view(), name='list'),
|
||||
path('new', views.new_or_update_schedule, name='new'),
|
||||
#path('<int:pk>', views.ScheduleDetailView.as_view(), name='detail'),
|
||||
path('<int:schedule_id>/clone', views.new_or_update_schedule, name='clone'),
|
||||
|
||||
]
|
@ -12,6 +12,13 @@ import json
|
||||
|
||||
# Create your views here.
|
||||
class ScheduleListView(LoginRequiredMixin,ListView):
|
||||
"""
|
||||
This view will give a list of all entered schedules. The list is filtered on the logged in employee.
|
||||
|
||||
Only the schedules owned by the logged in user are shown.
|
||||
|
||||
The results are shown with 10 items per page. A pager will be shown when there are more then 10 schedules
|
||||
"""
|
||||
|
||||
model = Schedule
|
||||
paginate_by = 10
|
||||
@ -21,12 +28,29 @@ class ScheduleListView(LoginRequiredMixin,ListView):
|
||||
|
||||
@login_required
|
||||
def new_or_update_schedule(request, schedule_id = None):
|
||||
"""
|
||||
This view will create or update an existing schedule. At the moment there is not a real update, but a clone functionality.
|
||||
So every schedule that is updated will be stored as a new schedule.
|
||||
|
||||
Only schedules owned by the logged in user can be loaded here and can be cloned.
|
||||
|
||||
The data of the form is stored as a JSON object in a single database field for more flexibility.
|
||||
|
||||
Arguments:
|
||||
request HttpRequest -- This is the HTTP request from the Django framework. This will hold the current logged in user info.
|
||||
|
||||
Keyword Arguments:
|
||||
schedule_id Schedule -- This is the schedule to be edited. When none, a new schedule will be created (default: {None})
|
||||
|
||||
Returns:
|
||||
A view with an empty form to create a new schedule or a prefilled form for cloning.
|
||||
"""
|
||||
template_name = 'schedule/schedule_new.html'
|
||||
|
||||
schedule = None
|
||||
if schedule_id is not None:
|
||||
try:
|
||||
schedule = Schedule.objects.get(pk=schedule_id)
|
||||
schedule = Schedule.objects.get(pk=schedule_id,employee=request.user.employee)
|
||||
except Schedule.DoesNotExist:
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user