Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Commits
c18500cb
Commit
c18500cb
authored
8 years ago
by
Piotr Matyjaszyk
Browse files
Options
Downloads
Plain Diff
pre-pull fix
parents
3725059d
5f47fc61
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/forms.py
+27
-1
27 additions, 1 deletion
smash/web/forms.py
smash/web/views.py
+1
-2
1 addition, 2 deletions
smash/web/views.py
with
28 additions
and
3 deletions
smash/web/forms.py
+
27
−
1
View file @
c18500cb
from
django
import
forms
from
django.forms
import
ModelForm
from
.models
import
*
from
datetime
import
datetime
"""
Possibl redundancy, but if need arises, contents of forms can be easily customized
Possibl
e
redundancy, but if need arises, contents of forms can be easily customized
"""
CURRENT_YEAR
=
datetime
.
now
().
year
YEAR_CHOICES
=
tuple
(
range
(
CURRENT_YEAR
,
CURRENT_YEAR
-
120
,
-
1
))
class
SubjectAddForm
(
ModelForm
):
date_born
=
forms
.
DateField
(
label
=
'
Date of birth
'
,
widget
=
forms
.
SelectDateWidget
(
years
=
YEAR_CHOICES
)
)
class
Meta
:
model
=
Subject
fields
=
'
__all__
'
...
...
@@ -19,6 +28,10 @@ class SubjectDetailForm(ModelForm):
class
SubjectEditForm
(
ModelForm
):
date_born
=
forms
.
DateField
(
label
=
'
Date of birth
'
,
widget
=
forms
.
SelectDateWidget
(
years
=
YEAR_CHOICES
)
)
class
Meta
:
model
=
Subject
fields
=
'
__all__
'
...
...
@@ -54,11 +67,24 @@ class AppointmentAddForm(ModelForm):
exclude
=
[
'
is_finished
'
]
class
VisitDetailForm
(
ModelForm
):
datetime_begin
=
forms
.
DateField
(
label
=
"
Visit begins on
"
,
widget
=
forms
.
SelectDateWidget
(
years
=
YEAR_CHOICES
)
)
datetime_end
=
forms
.
DateField
(
label
=
"
Visit ends on
"
,
widget
=
forms
.
SelectDateWidget
(
years
=
YEAR_CHOICES
)
)
class
Meta
:
model
=
Visit
exclude
=
[
'
is_finished
'
]
class
VisitAddForm
(
ModelForm
):
datetime_begin
=
forms
.
DateField
(
label
=
"
Visit begins on
"
,
widget
=
forms
.
SelectDateWidget
(
years
=
YEAR_CHOICES
)
)
datetime_end
=
forms
.
DateField
(
label
=
"
Visit ends on
"
,
widget
=
forms
.
SelectDateWidget
(
years
=
YEAR_CHOICES
)
)
class
Meta
:
model
=
Visit
exclude
=
[
'
is_finished
'
]
This diff is collapsed.
Click to expand it.
smash/web/views.py
+
1
−
2
View file @
c18500cb
...
...
@@ -9,6 +9,7 @@ from django.forms import modelformset_factory
from
django.shortcuts
import
render
from
django.db.models
import
Q
import
collections
import
datetime
def
index
(
request
):
if
request
.
user
.
is_authenticated
():
...
...
@@ -248,8 +249,6 @@ def suggest_details(Appointment appoint):
"""
def
assignments
(
request
):
futureDate
=
datetime
.
datetime
.
now
()
+
datetime
.
timedelta
(
days
=
93
)
planning_list
=
Appointment
.
objects
.
filter
(
datetime_when__isnull
=
True
,
visit__datetime_begin__lt
=
futureDate
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment