Skip to content

Commit

Permalink
[#1047] Merge 'develop' into branch
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed Feb 16, 2015
2 parents 41330e0 + 7bf1d86 commit 0897485
Show file tree
Hide file tree
Showing 88 changed files with 7,361 additions and 411 deletions.
32 changes: 32 additions & 0 deletions akvo/rest/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,36 @@
from .employment import EmploymentSerializer
from .focus_area import FocusAreaSerializer
from .goal import GoalSerializer
from .indicator import IndicatorPeriodSerializer, IndicatorSerializer
from .internal_organisation_id import InternalOrganisationIDSerializer
from .invoice import InvoiceSerializer
from .keyword import KeywordSerializer
from .legacy_data import LegacyDataSerializer
from .link import LinkSerializer
from .organisation import OrganisationSerializer
from .organisation_location import OrganisationLocationSerializer
from .partner_site import PartnerSiteSerializer
from .partner_type import PartnerTypeSerializer
from .partnership import PartnershipSerializer
from .planned_disbursement import PlannedDisbursementSerializer
from .policy_marker import PolicyMarkerSerializer
from .project import ProjectSerializer, ProjectExtraSerializer
from .project_comment import ProjectCommentSerializer
from .project_condition import ProjectConditionSerializer
from .project_contact import ProjectContactSerializer
from .project_document import ProjectDocumentSerializer
from .project_location import ProjectLocationSerializer
from .project_update import ProjectUpdateSerializer, ProjectUpdateExtraSerializer
from .project_update_location import ProjectUpdateLocationSerializer
from .publishing_status import PublishingStatusSerializer
from .recipient_country import RecipientCountrySerializer
from .region import RecipientRegionSerializer
from .related_project import RelatedProjectSerializer
from .result import ResultSerializer
from .sector import SectorSerializer
from .transaction import TransactionSerializer
from .user import UserSerializer, UserDetailsSerializer, UserPasswordSerializer
from .project import ProjectSerializer, ProjectExtraSerializer

__all__ = [
'BenchmarkSerializer',
Expand All @@ -39,23 +54,40 @@
'EmploymentSerializer',
'FocusAreaSerializer',
'GoalSerializer',
'IndicatorPeriodSerializer',
'IndicatorSerializer',
'InternalOrganisationIDSerializer',
'InvoiceSerializer',
'KeywordSerializer',
'LegacyDataSerializer',
'LinkSerializer',
'OrganisationSerializer',
'OrganisationLocationSerializer',
'PartnerSiteSerializer',
'PartnerTypeSerializer',
'PartnershipSerializer',
'PlannedDisbursementSerializer',
'PolicyMarkerSerializer',
'ProjectSerializer',
'ProjectExtraSerializer',
'ProjectCommentSerializer',
'ProjectConditionSerializer',
'ProjectContactSerializer',
'ProjectDocumentSerializer',
'ProjectLocationSerializer',
'ProjectUpdateSerializer',
'ProjectUpdateExtraSerializer',
'ProjectUpdateLocationSerializer',
'PublishingStatusSerializer',
'RecipientCountrySerializer',
'RecipientRegionSerializer',
'RelatedProjectSerializer',
'ResultSerializer',
'SectorSerializer',
'TransactionSerializer',
'UserSerializer',
'UserDetailsSerializer',
'UserPasswordSerializer',
'ProjectSerializer',
'ProjectExtraSerializer',
]
24 changes: 24 additions & 0 deletions akvo/rest/serializers/indicator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from akvo.rsr.models import IndicatorPeriod, Indicator

from .rsr_serializer import BaseRSRSerializer


class IndicatorPeriodSerializer(BaseRSRSerializer):

class Meta:
model = IndicatorPeriod


class IndicatorSerializer(BaseRSRSerializer):

periods = IndicatorPeriodSerializer(many=True, required=False, allow_add_remove=True)

class Meta:
model = Indicator
16 changes: 16 additions & 0 deletions akvo/rest/serializers/keyword.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from akvo.rsr.models import Keyword

from .rsr_serializer import BaseRSRSerializer


class KeywordSerializer(BaseRSRSerializer):

class Meta:
model = Keyword
16 changes: 16 additions & 0 deletions akvo/rest/serializers/legacy_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from akvo.rsr.models import LegacyData

from .rsr_serializer import BaseRSRSerializer


class LegacyDataSerializer(BaseRSRSerializer):

class Meta:
model = LegacyData
16 changes: 16 additions & 0 deletions akvo/rest/serializers/planned_disbursement.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from akvo.rsr.models import PlannedDisbursement

from .rsr_serializer import BaseRSRSerializer


class PlannedDisbursementSerializer(BaseRSRSerializer):

class Meta:
model = PlannedDisbursement
16 changes: 16 additions & 0 deletions akvo/rest/serializers/policy_marker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from akvo.rsr.models import PolicyMarker

from .rsr_serializer import BaseRSRSerializer


class PolicyMarkerSerializer(BaseRSRSerializer):

class Meta:
model = PolicyMarker
51 changes: 48 additions & 3 deletions akvo/rest/serializers/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,36 @@
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.

from rest_framework import serializers

from akvo.rsr.models import Project

from ..fields import Base64ImageField

from .budget_item import BudgetItemSerializer
from .legacy_data import LegacyDataSerializer
from .link import LinkSerializer
from .partnership import PartnershipSerializer
from .planned_disbursement import PlannedDisbursementSerializer
from .policy_marker import PolicyMarkerSerializer
from .project_comment import ProjectCommentSerializer
from .project_document import ProjectDocumentSerializer
from .project_location import ProjectLocationExtraSerializer
from .project_condition import ProjectConditionSerializer
from .project_contact import ProjectContactSerializer
from .project_update import ProjectUpdateSerializer
from .recipient_country import RecipientCountrySerializer
from .region import RecipientRegionSerializer
from .related_project import RelatedProjectSerializer
from .result import ResultSerializer
from .sector import SectorSerializer
from .transaction import TransactionSerializer
from .rsr_serializer import BaseRSRSerializer


class ProjectSerializer(BaseRSRSerializer):

publishing_status = serializers.Field(source='publishingstatus.status')
current_image = Base64ImageField(required=False, allow_empty_file=True)

class Meta:
Expand All @@ -23,9 +42,35 @@ class Meta:

class ProjectExtraSerializer(ProjectSerializer):

locations = ProjectLocationExtraSerializer(source='locations', many=True)
publishing_status = serializers.Field(source='publishingstatus.status')
budget_items = BudgetItemSerializer(source='budget_items', many=True, required=False, allow_add_remove=True)
legacy_data = LegacyDataSerializer(source='legacy_data', many=True, required=False, allow_add_remove=True)
links = LinkSerializer(source='links', many=True, required=False, allow_add_remove=True)
locations = ProjectLocationExtraSerializer(source='locations', many=True, required=False, allow_add_remove=True)
planned_disbursements = PlannedDisbursementSerializer(
source='planned_disbursements', many=True, required=False, allow_add_remove=True
)
policy_markers = PolicyMarkerSerializer(source='policy_markers', many=True, required=False, allow_add_remove=True)
documents = ProjectDocumentSerializer(source='documents', many=True, required=False, allow_add_remove=True)
comments = ProjectCommentSerializer(source='comments', many=True, required=False, allow_add_remove=True)
conditions = ProjectConditionSerializer(source='conditions', many=True, required=False, allow_add_remove=True)
contacts = ProjectContactSerializer(source='contacts', many=True, required=False, allow_add_remove=True)
project_updates = ProjectUpdateSerializer(
source='project_updates', many=True, required=False, allow_add_remove=True
)
recipient_countries = RecipientCountrySerializer(
source='recipient_countries', many=True, required=False, allow_add_remove=True
)
recipient_regions = RecipientRegionSerializer(
source='recipient_regions', many=True, required=False, allow_add_remove=True
)
related_projects = RelatedProjectSerializer(
source='related_projects', many=True, required=False, allow_add_remove=True
)
results = ResultSerializer(source='results', many=True, required=False, allow_add_remove=True)
sectors = SectorSerializer(source='sectors', many=True, required=False, allow_add_remove=True)
transactions = TransactionSerializer(source='transactions', many=True, required=False, allow_add_remove=True)
partnerships = PartnershipSerializer(source='partnerships', many=True)


class Meta(ProjectSerializer.Meta):
class Meta(ProjectSerializer.Meta):
pass
16 changes: 16 additions & 0 deletions akvo/rest/serializers/project_condition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from akvo.rsr.models import ProjectCondition

from .rsr_serializer import BaseRSRSerializer


class ProjectConditionSerializer(BaseRSRSerializer):

class Meta:
model = ProjectCondition
16 changes: 16 additions & 0 deletions akvo/rest/serializers/project_contact.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from akvo.rsr.models import ProjectContact

from .rsr_serializer import BaseRSRSerializer


class ProjectContactSerializer(BaseRSRSerializer):

class Meta:
model = ProjectContact
16 changes: 16 additions & 0 deletions akvo/rest/serializers/project_document.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from akvo.rsr.models import ProjectDocument

from .rsr_serializer import BaseRSRSerializer


class ProjectDocumentSerializer(BaseRSRSerializer):

class Meta:
model = ProjectDocument
2 changes: 1 addition & 1 deletion akvo/rest/serializers/project_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class ProjectUpdateSerializer(BaseRSRSerializer):

locations = ProjectUpdateLocationSerializer(source='locations', many=True)
locations = ProjectUpdateLocationSerializer(source='locations', many=True, required=False, allow_add_remove=True)
photo = Base64ImageField(required=False, allow_empty_file=True)

class Meta:
Expand Down
1 change: 1 addition & 0 deletions akvo/rest/serializers/project_update_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Meta:
model = ProjectUpdateLocation
exclude = ('location_target',)


class ProjectUpdateLocationExtraSerializer(ProjectUpdateLocationSerializer):

class Meta(ProjectUpdateLocationSerializer.Meta):
Expand Down
16 changes: 16 additions & 0 deletions akvo/rest/serializers/recipient_country.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from akvo.rsr.models import RecipientCountry

from .rsr_serializer import BaseRSRSerializer


class RecipientCountrySerializer(BaseRSRSerializer):

class Meta:
model = RecipientCountry
16 changes: 16 additions & 0 deletions akvo/rest/serializers/region.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from akvo.rsr.models import RecipientRegion

from .rsr_serializer import BaseRSRSerializer


class RecipientRegionSerializer(BaseRSRSerializer):

class Meta:
model = RecipientRegion
16 changes: 16 additions & 0 deletions akvo/rest/serializers/related_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from akvo.rsr.models import RelatedProject

from .rsr_serializer import BaseRSRSerializer


class RelatedProjectSerializer(BaseRSRSerializer):

class Meta:
model = RelatedProject
19 changes: 19 additions & 0 deletions akvo/rest/serializers/result.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-

# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


from akvo.rsr.models import Result

from .indicator import IndicatorSerializer
from .rsr_serializer import BaseRSRSerializer


class ResultSerializer(BaseRSRSerializer):

indicators = IndicatorSerializer(many=True, required=False, allow_add_remove=True)

class Meta:
model = Result
Loading

0 comments on commit 0897485

Please sign in to comment.