diff --git a/akvo/cordaid_org_importer.py b/akvo/cordaid_org_importer.py index 4a273cf87c..901004ffa6 100644 --- a/akvo/cordaid_org_importer.py +++ b/akvo/cordaid_org_importer.py @@ -16,7 +16,7 @@ from django.core.files.temp import NamedTemporaryFile from akvo.codelists.store.codelists_v201 import ORGANISATION_TYPE as IATI_LIST_ORGANISATION_TYPE -from akvo.rsr.models import InternalOrganisationID, Organisation, PartnerType +from akvo.rsr.models import InternalOrganisationID, Organisation from akvo.utils import model_and_instance_based_filename @@ -95,8 +95,6 @@ def import_orgs(xml_file): identifier=identifier ) internal_org_id.save() - for partner_type in PartnerType.objects.all(): - referenced_org.partner_types.add(partner_type) except Exception, e: action = "failed" internal_org_id.delete() diff --git a/akvo/rest/serializers/__init__.py b/akvo/rest/serializers/__init__.py index 1215db53e4..c4cb7871a2 100644 --- a/akvo/rest/serializers/__init__.py +++ b/akvo/rest/serializers/__init__.py @@ -27,7 +27,6 @@ from .organisation_location import (OrganisationLocationSerializer, MapOrganisationLocationSerializer) from .partner_site import PartnerSiteSerializer -from .partner_type import PartnerTypeSerializer from .partnership import PartnershipSerializer from .planned_disbursement import PlannedDisbursementSerializer from .policy_marker import PolicyMarkerSerializer @@ -82,7 +81,6 @@ 'OrganisationLocationSerializer', 'PartnershipSerializer', 'PartnerSiteSerializer', - 'PartnerTypeSerializer', 'PlannedDisbursementSerializer', 'PolicyMarkerSerializer', 'ProjectCommentSerializer', diff --git a/akvo/rest/serializers/partner_type.py b/akvo/rest/serializers/partner_type.py deleted file mode 100644 index a3d123fc05..0000000000 --- a/akvo/rest/serializers/partner_type.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- 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 PartnerType - -from .rsr_serializer import BaseRSRSerializer - - -class PartnerTypeSerializer(BaseRSRSerializer): - - class Meta: - model = PartnerType diff --git a/akvo/rest/urls.py b/akvo/rest/urls.py index 23f7bf10fb..425277c909 100644 --- a/akvo/rest/urls.py +++ b/akvo/rest/urls.py @@ -36,7 +36,6 @@ router.register(r'organisation_location', views.OrganisationLocationViewSet) router.register(r'organisation_map_location', views.MapOrganisationLocationViewSet) router.register(r'partner_site', views.PartnerSiteViewSet) -router.register(r'partner_type', views.PartnerTypeViewSet) router.register(r'partnership', views.PartnershipViewSet) router.register(r'planned_disbursement', views.PlannedDisbursementViewSet) router.register(r'policy_marker', views.PolicyMarkerViewSet) diff --git a/akvo/rest/views/__init__.py b/akvo/rest/views/__init__.py index 38977b6865..e462ea814c 100644 --- a/akvo/rest/views/__init__.py +++ b/akvo/rest/views/__init__.py @@ -26,7 +26,6 @@ from .organisation import OrganisationViewSet from .organisation_location import OrganisationLocationViewSet, MapOrganisationLocationViewSet from .partner_site import PartnerSiteViewSet -from .partner_type import PartnerTypeViewSet from .partnership import PartnershipViewSet from .planned_disbursement import PlannedDisbursementViewSet from .policy_marker import PolicyMarkerViewSet @@ -98,7 +97,6 @@ 'OrganisationCustomFieldViewSet', 'PartnershipViewSet', 'PartnerSiteViewSet', - 'PartnerTypeViewSet', 'PlannedDisbursementViewSet', 'PolicyMarkerViewSet', 'ProjectCommentViewSet', diff --git a/akvo/rest/views/partner_type.py b/akvo/rest/views/partner_type.py deleted file mode 100644 index 3bcd022fd2..0000000000 --- a/akvo/rest/views/partner_type.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- 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 PartnerType - -from ..serializers import PartnerTypeSerializer -from ..viewsets import BaseRSRViewSet - - -class PartnerTypeViewSet(BaseRSRViewSet): - """ - """ - queryset = PartnerType.objects.all() - serializer_class = PartnerTypeSerializer diff --git a/akvo/rsr/admin.py b/akvo/rsr/admin.py index b330febf7b..b77ce2b9c5 100644 --- a/akvo/rsr/admin.py +++ b/akvo/rsr/admin.py @@ -99,10 +99,9 @@ class OrganisationAdmin(TimestampsAdminDisplayMixin, ObjectPermissionsModelAdmin fieldsets = ( (_(u'General information'), {'fields': ( - 'name', 'long_name', 'partner_types', 'organisation_type', - 'new_organisation_type', 'can_become_reporting', 'logo', 'url', 'facebook', - 'twitter', 'linkedin', 'iati_org_id', 'public_iati_file', 'language', 'content_owner', - 'allow_edit',)}), + 'name', 'long_name', 'organisation_type', 'new_organisation_type', + 'can_become_reporting', 'logo', 'url', 'facebook', 'twitter', 'linkedin', 'iati_org_id', + 'public_iati_file', 'language', 'content_owner', 'allow_edit',)}), (_(u'Contact information'), {'fields': ('phone', 'mobile', 'fax', 'contact_person', 'contact_email', ), }), (_(u'About the organisation'), {'fields': ('description', 'notes',)}), @@ -121,16 +120,6 @@ def __init__(self, model, admin_site): self.formfield_overrides = {ImageField: {'widget': widgets.AdminFileWidget}, } super(OrganisationAdmin, self).__init__(model, admin_site) - def allowed_partner_types(self, obj): - return ', '.join([pt.label for pt in obj.partner_types.all()]) - - def get_list_display(self, request): - # see the notes fields in the change list if you have the right permissions - if request.user.has_perm(self.opts.app_label + '.' + get_permission_codename('change', - self.opts)): - return list(self.list_display) + ['allowed_partner_types'] - return super(OrganisationAdmin, self).get_list_display(request) - def get_readonly_fields(self, request, obj=None): """Make sure only super users can set the ability to become a reporting org""" if request.user.is_superuser: diff --git a/akvo/rsr/migrations/0022_auto_20150817_1120.py b/akvo/rsr/migrations/0022_auto_20150817_1120.py new file mode 100644 index 0000000000..b04604969f --- /dev/null +++ b/akvo/rsr/migrations/0022_auto_20150817_1120.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('rsr', '0021_auto_20150813_1426'), + ] + + operations = [ + migrations.RemoveField( + model_name='organisation', + name='partner_types', + ), + migrations.DeleteModel( + name='PartnerType', + ), + ] diff --git a/akvo/rsr/models/__init__.py b/akvo/rsr/models/__init__.py index bd1de081e9..f1a907e447 100644 --- a/akvo/rsr/models/__init__.py +++ b/akvo/rsr/models/__init__.py @@ -43,7 +43,6 @@ from .organisation import Organisation from .organisation_account import OrganisationAccount from .partner_site import PartnerSite -from .partner_type import PartnerType from .partnership import Partnership from .payment_gateway import PayPalGateway, MollieGateway, PaymentGatewaySelector from .planned_disbursement import PlannedDisbursement @@ -94,7 +93,6 @@ 'OrganisationAccount', 'OrganisationCustomField', 'PartnerSite', - 'PartnerType', 'Partnership', 'PayPalGateway', 'MollieGateway', @@ -154,9 +152,6 @@ rules.add_perm('rsr.add_partnersite', is_rsr_admin) rules.add_perm('rsr.change_partnersite', is_rsr_admin | is_org_admin) -rules.add_perm('rsr.add_partnertype', is_rsr_admin) -rules.add_perm('rsr.change_partnertype', is_rsr_admin) - rules.add_perm('rsr.change_organisationaccount', is_rsr_admin) rules.add_perm('rsr.add_projectupdate', is_rsr_admin | is_org_admin | is_org_user_manager | diff --git a/akvo/rsr/models/organisation.py b/akvo/rsr/models/organisation.py index e54c3668fd..86817ebcaa 100644 --- a/akvo/rsr/models/organisation.py +++ b/akvo/rsr/models/organisation.py @@ -20,7 +20,6 @@ from akvo.codelists.store.codelists_v201 import ORGANISATION_TYPE as IATI_LIST_ORGANISATION_TYPE from .country import Country -from .partner_type import PartnerType from .partner_site import PartnerSite from .partnership import Partnership from .publishing_status import PublishingStatus @@ -88,7 +87,6 @@ def org_type_from_iati_type(cls, iati_type): _(u'language'), max_length=2, choices=settings.LANGUAGES, default='en', help_text=_(u'The main language of the organisation'), ) - partner_types = models.ManyToManyField(PartnerType) organisation_type = ValidXMLCharField( _(u'organisation type'), max_length=1, db_index=True, choices=ORG_TYPES ) diff --git a/akvo/rsr/models/partner_type.py b/akvo/rsr/models/partner_type.py deleted file mode 100644 index 4f5698c656..0000000000 --- a/akvo/rsr/models/partner_type.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- 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 django.db import models - -from ..fields import ValidXMLCharField - - -class PartnerType(models.Model): - id = ValidXMLCharField(max_length=8, primary_key=True, unique=True) - label = ValidXMLCharField(max_length=30, unique=True) - - def __unicode__(self): - return self.label - - class Meta: - app_label = 'rsr' - ordering = ('label',)