diff options
Diffstat (limited to 'ctrack/caf')
-rw-r--r-- | ctrack/caf/admin.py | 4 | ||||
-rw-r--r-- | ctrack/caf/migrations/0013_auto_20200227_0827.py | 18 | ||||
-rw-r--r-- | ctrack/caf/models.py | 4 | ||||
-rw-r--r-- | ctrack/caf/tests/factories.py | 9 |
4 files changed, 26 insertions, 9 deletions
diff --git a/ctrack/caf/admin.py b/ctrack/caf/admin.py index 6a87233..661a793 100644 --- a/ctrack/caf/admin.py +++ b/ctrack/caf/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin -from .models import CAF, CAFFileStore, DocumentFile, Grading, EssentialService +from .models import CAF, FileStore, DocumentFile, Grading, EssentialService class EssentialServiceListAdmin(admin.ModelAdmin): @@ -23,7 +23,7 @@ class CAFAdmin(admin.ModelAdmin): admin.site.register(CAF, CAFAdmin) -admin.site.register(CAFFileStore) +admin.site.register(FileStore) admin.site.register(DocumentFile) admin.site.register(Grading) admin.site.register(EssentialService, EssentialServiceListAdmin) diff --git a/ctrack/caf/migrations/0013_auto_20200227_0827.py b/ctrack/caf/migrations/0013_auto_20200227_0827.py new file mode 100644 index 0000000..6aab6b4 --- /dev/null +++ b/ctrack/caf/migrations/0013_auto_20200227_0827.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.9 on 2020-02-27 08:27 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('organisations', '0004_auto_20200220_1634'), + ('caf', '0012_auto_20200226_2202'), + ] + + operations = [ + migrations.RenameModel( + old_name='CAFFileStore', + new_name='FileStore', + ), + ] diff --git a/ctrack/caf/models.py b/ctrack/caf/models.py index 2a9310c..c17f064 100644 --- a/ctrack/caf/models.py +++ b/ctrack/caf/models.py @@ -13,7 +13,7 @@ class Grading(models.Model): return self.descriptor -class CAFFileStore(models.Model): +class FileStore(models.Model): descriptor = models.CharField(max_length=100) virtual_location = models.CharField( max_length=100, help_text="USB, Rosa, email, etc" @@ -33,7 +33,7 @@ class DocumentFile(models.Model): FILETYPE_CHOICES = [(1, "Excel"), (2, "Word"), (3, "PDF"), (4, "Hard Copy")] name = models.CharField(max_length=255) type = models.IntegerField(choices=FILETYPE_CHOICES, default=1) - file_store_location = models.ForeignKey(CAFFileStore, on_delete=models.CASCADE) + file_store_location = models.ForeignKey(FileStore, on_delete=models.CASCADE) class EssentialService(models.Model): diff --git a/ctrack/caf/tests/factories.py b/ctrack/caf/tests/factories.py index ce337f2..53953fe 100644 --- a/ctrack/caf/tests/factories.py +++ b/ctrack/caf/tests/factories.py @@ -3,7 +3,7 @@ import random import factory from factory import Faker -from ctrack.caf.models import EssentialService, Grading, DocumentFile, FileStore, CAFFileStore +from ctrack.caf.models import EssentialService, Grading, DocumentFile, FileStore from ctrack.organisations.tests.factories import OrganisationFactory @@ -23,21 +23,20 @@ class GradingFactory(factory.DjangoModelFactory): model = Grading -# TODO: test these two factories -class CAFFileStoreFactory(factory.DjangoModelFactory): +class FileStoreFactory(factory.DjangoModelFactory): descriptor = "File Store X" virtual_location = Faker("street_name") physical_location = random.choice(["Cupboard A", "Tin Box", "The Vault"]) physical_location_organisation = factory.SubFactory(OrganisationFactory) class Meta: - model = CAFFileStore + model = FileStore class DocumentFileFactory(factory.DjangoModelFactory): name = Faker("file_name", extension="xlsx") type = random.choice([1, 2, 3, 4]) - file_store_location = factory.SubFactory(CAFFileStoreFactory) + file_store_location = factory.SubFactory(FileStoreFactory) class Meta: model = DocumentFile |