Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Sith
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
59
Issues
59
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AE
Sith
Commits
aa17c44b
Commit
aa17c44b
authored
Aug 05, 2016
by
Skia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add location when subscribing
parent
260a17ae
Pipeline
#86
passed with stage
in 2 minutes and 38 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
2 deletions
+31
-2
sith/settings_sample.py
sith/settings_sample.py
+6
-0
subscription/migrations/0003_subscription_location.py
subscription/migrations/0003_subscription_location.py
+20
-0
subscription/models.py
subscription/models.py
+2
-0
subscription/views.py
subscription/views.py
+3
-2
No files found.
sith/settings_sample.py
View file @
aa17c44b
...
...
@@ -257,6 +257,12 @@ SITH_SUBSCRIPTION_PAYMENT_METHOD = [
(
'other'
,
_
(
'Other'
)),
]
SITH_SUBSCRIPTION_LOCATIONS
=
[
(
'BELFORT'
,
_
(
'Belfort'
)),
(
'SEVENANS'
,
_
(
'Sevenans'
)),
(
'MONTBELIARD'
,
_
(
'Montbéliard'
)),
]
SITH_COUNTER_BARS
=
[
(
1
,
"Foyer"
),
(
2
,
"MDE"
),
...
...
subscription/migrations/0003_subscription_location.py
0 → 100644
View file @
aa17c44b
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'subscription'
,
'0002_auto_20160718_1805'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'subscription'
,
name
=
'location'
,
field
=
models
.
CharField
(
max_length
=
20
,
verbose_name
=
'location'
,
choices
=
[(
'BELFORT'
,
'Belfort'
),
(
'SEVENANS'
,
'Sevenans'
),
(
'MONTBELIARD'
,
'Montbéliard'
)],
default
=
'BELFORT'
),
preserve_default
=
False
,
),
]
subscription/models.py
View file @
aa17c44b
...
...
@@ -32,6 +32,8 @@ class Subscription(models.Model):
subscription_start
=
models
.
DateField
(
_
(
'subscription start'
))
subscription_end
=
models
.
DateField
(
_
(
'subscription end'
))
payment_method
=
models
.
CharField
(
_
(
'payment method'
),
max_length
=
255
,
choices
=
settings
.
SITH_SUBSCRIPTION_PAYMENT_METHOD
)
location
=
models
.
CharField
(
choices
=
settings
.
SITH_SUBSCRIPTION_LOCATIONS
,
max_length
=
20
,
verbose_name
=
_
(
'location'
))
# TODO add location!
class
Meta
:
...
...
subscription/views.py
View file @
aa17c44b
...
...
@@ -19,7 +19,7 @@ def get_subscriber(user):
class
SubscriptionForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Subscription
fields
=
[
'member'
,
'subscription_type'
,
'payment_method'
]
fields
=
[
'member'
,
'subscription_type'
,
'payment_method'
,
'location'
]
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
SubscriptionForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
...
...
@@ -29,6 +29,7 @@ class SubscriptionForm(forms.ModelForm):
self
.
fields
[
'email'
]
=
forms
.
EmailField
()
self
.
fields
.
move_to_end
(
'subscription_type'
)
self
.
fields
.
move_to_end
(
'payment_method'
)
self
.
fields
.
move_to_end
(
'location'
)
def
clean
(
self
):
cleaned_data
=
super
(
SubscriptionForm
,
self
).
clean
()
...
...
@@ -56,7 +57,7 @@ class SubscriptionForm(forms.ModelForm):
raise
ValidationError
(
_
(
"You must either choose an existing user or create a new one properly"
))
return
cleaned_data
class
NewSubscription
(
CanEditMixin
,
CreateView
):
# TODO: this must be able to create a new user if needed
class
NewSubscription
(
CanEditMixin
,
CreateView
):
template_name
=
'subscription/subscription.jinja'
form_class
=
SubscriptionForm
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment