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
C
campaign
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
piphone
campaign
Commits
946d9d6d
Commit
946d9d6d
authored
Jan 15, 2015
by
Mindiell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correcting REST API for rest_framework v3. Plus migrations
parent
794941fd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
206 additions
and
7 deletions
+206
-7
picampaign/campaign/migrations/0001_initial.py
picampaign/campaign/migrations/0001_initial.py
+59
-0
picampaign/campaign/serializers.py
picampaign/campaign/serializers.py
+7
-6
picampaign/contact/migrations/0001_initial.py
picampaign/contact/migrations/0001_initial.py
+28
-0
picampaign/feedback/migrations/0001_initial.py
picampaign/feedback/migrations/0001_initial.py
+27
-0
picampaign/organization/migrations/0001_initial.py
picampaign/organization/migrations/0001_initial.py
+84
-0
picampaign/organization/serializers.py
picampaign/organization/serializers.py
+1
-1
No files found.
picampaign/campaign/migrations/0001_initial.py
0 → 100644
View file @
946d9d6d
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'contact'
,
'0001_initial'
),
(
'organization'
,
'0001_initial'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Argumentary'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
serialize
=
False
,
primary_key
=
True
)),
(
'lang'
,
models
.
CharField
(
max_length
=
5
,
verbose_name
=
'language'
,
choices
=
[(
b
'en'
,
'English'
),
(
b
'de'
,
'German'
),
(
b
'fr'
,
'French'
)])),
(
'text'
,
models
.
TextField
(
null
=
True
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
migrations
.
CreateModel
(
name
=
'Campaign'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
serialize
=
False
,
primary_key
=
True
)),
(
'title'
,
models
.
CharField
(
max_length
=
255
)),
(
'description'
,
models
.
CharField
(
max_length
=
512
,
blank
=
True
)),
(
'start_date'
,
models
.
DateField
()),
(
'end_date'
,
models
.
DateField
()),
(
'default_lang'
,
models
.
CharField
(
max_length
=
5
,
verbose_name
=
'language'
,
choices
=
[(
b
'en'
,
'English'
),
(
b
'de'
,
'German'
),
(
b
'fr'
,
'French'
)])),
(
'organization'
,
models
.
ForeignKey
(
related_name
=
'campaigns'
,
to
=
'organization.Organization'
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
migrations
.
CreateModel
(
name
=
'CampaignContact'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
serialize
=
False
,
primary_key
=
True
)),
(
'weight'
,
models
.
IntegerField
(
default
=
0
)),
(
'campaign'
,
models
.
ForeignKey
(
to
=
'campaign.Campaign'
)),
(
'contact'
,
models
.
ForeignKey
(
to
=
'contact.Contact'
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
migrations
.
AddField
(
model_name
=
'argumentary'
,
name
=
'campaign'
,
field
=
models
.
ForeignKey
(
to
=
'campaign.Campaign'
),
preserve_default
=
True
,
),
]
picampaign/campaign/serializers.py
View file @
946d9d6d
...
...
@@ -20,14 +20,15 @@ class CampaignSerializer(serializers.HyperlinkedModelSerializer):
class
CampaignContactSerializer
(
serializers
.
HyperlinkedModelSerializer
):
first_name
=
serializers
.
Field
(
source
=
'contact.first_name'
)
last_name
=
serializers
.
Field
(
source
=
'contact.last_name'
)
phone
=
serializers
.
Field
(
source
=
'contact.phone'
)
full_name
=
serializers
.
ReadOnlyField
(
source
=
'contact.full_name'
)
first_name
=
serializers
.
ReadOnlyField
(
source
=
'contact.first_name'
)
last_name
=
serializers
.
ReadOnlyField
(
source
=
'contact.last_name'
)
phone
=
serializers
.
ReadOnlyField
(
source
=
'contact.phone'
)
groups
=
GroupSerializer
(
many
=
True
,
source
=
'contact.groups'
)
contact_id
=
serializers
.
Field
(
source
=
'contact.id'
)
photo
=
serializers
.
Field
(
source
=
'contact.get_photo_url'
)
contact_id
=
serializers
.
ReadOnly
Field
(
source
=
'contact.id'
)
photo
=
serializers
.
ReadOnly
Field
(
source
=
'contact.get_photo_url'
)
class
Meta
:
model
=
CampaignContact
fields
=
(
'id'
,
'weight'
,
'contact_id'
,
'first_name'
,
'last_name'
,
'phone'
,
'groups'
,
'photo'
)
'f
ull_name'
,
'f
irst_name'
,
'last_name'
,
'phone'
,
'groups'
,
'photo'
)
picampaign/contact/migrations/0001_initial.py
0 → 100644
View file @
946d9d6d
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Contact'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
serialize
=
False
,
primary_key
=
True
)),
(
'first_name'
,
models
.
CharField
(
max_length
=
64
)),
(
'last_name'
,
models
.
CharField
(
max_length
=
64
)),
(
'phone'
,
models
.
CharField
(
max_length
=
32
)),
(
'twitter'
,
models
.
CharField
(
max_length
=
64
,
blank
=
True
)),
(
'mail'
,
models
.
CharField
(
max_length
=
255
,
blank
=
True
)),
(
'photo'
,
models
.
ImageField
(
upload_to
=
b
'contacts/photos'
,
blank
=
True
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
]
picampaign/feedback/migrations/0001_initial.py
0 → 100644
View file @
946d9d6d
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'campaign'
,
'0001_initial'
),
(
'organization'
,
'0001_initial'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Feedback'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
serialize
=
False
,
primary_key
=
True
)),
(
'comment'
,
models
.
CharField
(
max_length
=
512
,
blank
=
True
)),
(
'callee'
,
models
.
ForeignKey
(
to
=
'campaign.CampaignContact'
)),
(
'category'
,
models
.
ForeignKey
(
to
=
'organization.FeedbackCategory'
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
]
picampaign/organization/migrations/0001_initial.py
0 → 100644
View file @
946d9d6d
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
from
django.conf
import
settings
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'contact'
,
'0001_initial'
),
migrations
.
swappable_dependency
(
settings
.
AUTH_USER_MODEL
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'FeedbackCategory'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
serialize
=
False
,
primary_key
=
True
)),
(
'name'
,
models
.
CharField
(
max_length
=
64
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
migrations
.
CreateModel
(
name
=
'Group'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
serialize
=
False
,
primary_key
=
True
)),
(
'name'
,
models
.
CharField
(
max_length
=
64
)),
(
'media'
,
models
.
CharField
(
max_length
=
255
,
blank
=
True
)),
(
'contacts'
,
models
.
ManyToManyField
(
related_name
=
'groups'
,
null
=
True
,
to
=
'contact.Contact'
,
blank
=
True
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
migrations
.
CreateModel
(
name
=
'GroupType'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
serialize
=
False
,
primary_key
=
True
)),
(
'name'
,
models
.
CharField
(
max_length
=
64
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
migrations
.
CreateModel
(
name
=
'Organization'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
serialize
=
False
,
primary_key
=
True
)),
(
'name'
,
models
.
CharField
(
max_length
=
64
)),
(
'sip_key'
,
models
.
CharField
(
max_length
=
255
)),
(
'users'
,
models
.
ManyToManyField
(
related_name
=
'organizations'
,
null
=
True
,
to
=
settings
.
AUTH_USER_MODEL
,
blank
=
True
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
migrations
.
AddField
(
model_name
=
'grouptype'
,
name
=
'organization'
,
field
=
models
.
ForeignKey
(
to
=
'organization.Organization'
),
preserve_default
=
True
,
),
migrations
.
AddField
(
model_name
=
'group'
,
name
=
'organization'
,
field
=
models
.
ForeignKey
(
to
=
'organization.Organization'
),
preserve_default
=
True
,
),
migrations
.
AddField
(
model_name
=
'group'
,
name
=
'type'
,
field
=
models
.
ForeignKey
(
blank
=
True
,
to
=
'organization.GroupType'
,
null
=
True
),
preserve_default
=
True
,
),
migrations
.
AddField
(
model_name
=
'feedbackcategory'
,
name
=
'organization'
,
field
=
models
.
ForeignKey
(
to
=
'organization.Organization'
),
preserve_default
=
True
,
),
]
picampaign/organization/serializers.py
View file @
946d9d6d
...
...
@@ -10,7 +10,7 @@ class CategorySerializer(serializers.ModelSerializer):
class
GroupSerializer
(
serializers
.
ModelSerializer
):
type
=
serializers
.
Field
(
source
=
'type.name'
)
type
=
serializers
.
ReadOnly
Field
(
source
=
'type.name'
)
class
Meta
:
model
=
Group
...
...
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