diff --git a/factories/workflow_models.py b/factories/workflow_models.py index d8b4c42ea..cd99ef0df 100644 --- a/factories/workflow_models.py +++ b/factories/workflow_models.py @@ -12,7 +12,6 @@ Budget as BudgetM, Checklist as ChecklistM, CodedField as CodedFieldM, - Contact as ContactM, Country as CountryM, Documentation as DocumentationM, FundCode as FundCodeM, @@ -78,17 +77,6 @@ class Meta: code = 'AF' -class Contact(DjangoModelFactory): - class Meta: - model = ContactM - - name = 'Aryana Sayeed' - city = 'Kabul' - email = lazy_attribute(lambda o: slugify(o.name) + "@external-contact.com") - phone = '+93 555444333' - country = SubFactory(Country) - - class Organization(DjangoModelFactory): class Meta: model = OrganizationM diff --git a/workflow/admin.py b/workflow/admin.py index 6b045a80b..4d8b3e34e 100755 --- a/workflow/admin.py +++ b/workflow/admin.py @@ -12,7 +12,7 @@ WorkflowLevel2, WorkflowLevel2Sort, Documentation, SiteProfile, ProjectType, Budget, ProfileType, WorkflowTeam, ChecklistItem, Checklist, - Stakeholder, Contact, StakeholderType, TolaUser, TolaSites, + Stakeholder, StakeholderType, TolaUser, TolaSites, FormGuidance, TolaUserProxy, TolaBookmarks, Currency, ApprovalWorkflow, ApprovalType, FundCode, RiskRegister, IssueRegister, CodedField, WorkflowModules, Milestone, @@ -186,13 +186,6 @@ class ProjectTypeAdmin(admin.ModelAdmin): display = 'Project Type' -class ContactAdmin(admin.ModelAdmin): - list_display = ('name', 'country', 'create_date', 'edit_date') - display = 'Contact' - list_filter = ('create_date','country') - search_fields = ('name','country','title','city') - - class FundCodeAdmin(admin.ModelAdmin): list_display = ('name', 'create_date', 'edit_date') display = 'Fund Code' @@ -305,7 +298,6 @@ class WorkflowLevel1SectorAdmin(admin.ModelAdmin): admin.site.register(ChecklistItem, ChecklistItemAdmin) admin.site.register(Checklist, ChecklistAdmin) admin.site.register(Stakeholder, StakeholderAdmin) -admin.site.register(Contact, ContactAdmin) admin.site.register(StakeholderType) admin.site.register(TolaUser, TolaUserAdmin) admin.site.register(TolaSites, TolaSitesAdmin) diff --git a/workflow/migrations/0023_auto_20180425_0136.py b/workflow/migrations/0023_auto_20180425_0136.py new file mode 100644 index 000000000..1b18f1c78 --- /dev/null +++ b/workflow/migrations/0023_auto_20180425_0136.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.3 on 2018-04-25 08:36 +from __future__ import unicode_literals + +from django.db import migrations, models +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ('workflow', '0022_organization_allow_budget_decimal'), + ] + + operations = [ + migrations.RemoveField( + model_name='contact', + name='country', + ), + migrations.RemoveField( + model_name='contact', + name='organization', + ), + migrations.RemoveField( + model_name='contact', + name='workflowlevel1', + ), + migrations.RemoveField( + model_name='partner', + name='contact', + ), + migrations.RemoveField( + model_name='stakeholder', + name='contact', + ), + migrations.AlterField( + model_name='historicalworkflowlevel2', + name='level2_uuid', + field=models.CharField(blank=True, db_index=True, default=uuid.uuid4, editable=False, help_text='Unique ID', max_length=255, verbose_name='WorkflowLevel2 UUID'), + ), + migrations.AlterField( + model_name='historicalworkflowlevel2', + name='progress', + field=models.CharField(blank=True, choices=[('open', 'Open'), ('awaitingapproval', 'Awaiting Approval'), ('tracking', 'Tracking'), ('inprogress', 'In Progress'), ('invoiced', 'Invoiced'), ('closed', 'Closed')], default='open', max_length=50), + ), + migrations.AlterField( + model_name='workflowlevel1', + name='level1_uuid', + field=models.CharField(default=uuid.uuid4, editable=False, max_length=255, unique=True, verbose_name='WorkflowLevel1 UUID'), + ), + migrations.AlterField( + model_name='workflowlevel2', + name='level2_uuid', + field=models.CharField(blank=True, default=uuid.uuid4, editable=False, help_text='Unique ID', max_length=255, unique=True, verbose_name='WorkflowLevel2 UUID'), + ), + migrations.AlterField( + model_name='workflowlevel2', + name='progress', + field=models.CharField(blank=True, choices=[('open', 'Open'), ('awaitingapproval', 'Awaiting Approval'), ('tracking', 'Tracking'), ('inprogress', 'In Progress'), ('invoiced', 'Invoiced'), ('closed', 'Closed')], default='open', max_length=50), + ), + migrations.DeleteModel( + name='Contact', + ), + ] diff --git a/workflow/models.py b/workflow/models.py index 44b57f1ff..93265ef7b 100755 --- a/workflow/models.py +++ b/workflow/models.py @@ -957,41 +957,6 @@ def __unicode__(self): return new_name -class Contact(models.Model): - """ - A contact is a person or entity who may be approached for information or assistance about a Site. - - Example: Building Maintenance Manager at a Training Center. - """ - name = models.CharField("Name", max_length=255, blank=True, null=True) - title = models.CharField("Title", max_length=255, blank=True, null=True) - city = models.CharField("City/Town", max_length=255, blank=True, null=True) - address = models.TextField("Address", max_length=255, blank=True, null=True) - email = models.CharField("Email", max_length=255, blank=True, null=True) - phone = models.CharField("Phone", max_length=255, blank=True, null=True) - country = models.ForeignKey(Country) - organization = models.ForeignKey(Organization, blank=True, null=True) - workflowlevel1 = models.ForeignKey(WorkflowLevel1, blank=True, null=True) - create_date = models.DateTimeField(null=True, blank=True) - edit_date = models.DateTimeField(null=True, blank=True) - - class Meta: - ordering = ('name', 'country', 'title') - verbose_name_plural = "Contact" - - # onsave add create date or update edit date - def save(self, *args, **kwargs): - if self.create_date == None: - self.create_date = timezone.now() - self.edit_date = timezone.now() - super(Contact, self).save() - - def __unicode__(self): - if self.title: - return u"{}, {}".format(self.name, self.title) - else: - return unicode(self.name) - class StakeholderType(models.Model): name = models.CharField("Stakeholder Type", max_length=255, blank=True, null=True) default_global = models.BooleanField(default=0) @@ -1015,7 +980,7 @@ def __unicode__(self): class StakeholderManager(models.Manager): def get_queryset(self): - return super(StakeholderManager, self).get_queryset().prefetch_related('contact', 'sectors').select_related( + return super(StakeholderManager, self).get_queryset().prefetch_related('sectors').select_related( 'country', 'type', 'formal_relationship_document', 'vetting_document') @@ -1035,7 +1000,6 @@ class Stakeholder(models.Model): type = models.ForeignKey(StakeholderType, blank=True, null=True) role = models.CharField("Role", max_length=255, blank=True, null=True) contribution = models.CharField("Contribution", max_length=255, blank=True, null=True) - contact = models.ManyToManyField(Contact, max_length=255, blank=True) country = models.ForeignKey(Country, blank=True, null=True) organization = models.ForeignKey(Organization, default=1) workflowlevel1 = models.ManyToManyField(WorkflowLevel1, blank=True) @@ -1071,7 +1035,6 @@ class Partner(models.Model): partners_uuid = models.CharField(max_length=255, verbose_name='Partner UUID', default=uuid.uuid4, unique=True) name = models.CharField("Partner/Organization Name", max_length=255, blank=True, null=True) type = models.ForeignKey(StakeholderType, blank=True, null=True, related_name="stakeholder_partner") - contact = models.ManyToManyField(Contact, max_length=255, blank=True) country = models.ForeignKey(Country, blank=True, null=True) sectors = models.ManyToManyField(Sector, blank=True) organization = models.ForeignKey(Organization, default=1) diff --git a/workflow/tests/test_models.py b/workflow/tests/test_models.py index fa83e6a7c..9e8e64884 100644 --- a/workflow/tests/test_models.py +++ b/workflow/tests/test_models.py @@ -81,17 +81,6 @@ def test_print_instance_without_code(self): self.assertEqual(unicode(office), u'Office') -@tag('pkg') -class ContactTest(TestCase): - def test_print_instance(self): - contact = factories.Contact.build(title="Title") - self.assertEqual(unicode(contact), u'Aryana Sayeed, Title') - - def test_print_instance_without_title(self): - contact = factories.Contact.build() - self.assertEqual(unicode(contact), u'Aryana Sayeed') - - @tag('pkg') class WorkflowLevel2Test(TestCase): def test_print_instance(self):