From 8b9d490330289dd7ff08f123a200028d6c10c2f7 Mon Sep 17 00:00:00 2001 From: Mark Cabanero Date: Wed, 8 May 2019 20:21:12 -0400 Subject: [PATCH] Prepare for version 0.1.0 - Reset migrations - Fix tox issues (dependencies) --- hiber/apps/api/auth.py | 34 ++-- hiber/apps/api/serializers.py | 43 +++-- hiber/apps/api/urls.py | 7 +- hiber/apps/api/views.py | 43 +++-- .../apps/bathouse/migrations/0001_initial.py | 10 +- .../migrations/0002_auto_20190430_1729.py | 29 ---- hiber/apps/bathouse/models.py | 151 +++++++++--------- hiber/urls.py | 4 +- requirements/development.txt | 2 +- tox.ini | 4 +- 10 files changed, 139 insertions(+), 188 deletions(-) delete mode 100644 hiber/apps/bathouse/migrations/0002_auto_20190430_1729.py diff --git a/hiber/apps/api/auth.py b/hiber/apps/api/auth.py index f89beb7..e9e113e 100644 --- a/hiber/apps/api/auth.py +++ b/hiber/apps/api/auth.py @@ -7,27 +7,23 @@ path('users/me', views.UserView.as_view(), name='user'), path('users/create', views.UserCreateView.as_view(), name='user-create'), path('users/delete', views.UserDeleteView.as_view(), name='user-delete'), - path( - 'users/activate', views.ActivationView.as_view(), - name='user-activate'), - path( - 'users/activate/resend', - views.ResendActivationView.as_view(), - name='user-activate-resend'), + path('users/activate', + views.ActivationView.as_view(), + name='user-activate'), + path('users/activate/resend', + views.ResendActivationView.as_view(), + name='user-activate-resend'), path('password', views.SetPasswordView.as_view(), name='set-password'), - path( - 'password/reset', - views.PasswordResetView.as_view(), - name='reset-password'), - path( - 'password/reset/confirm', - views.PasswordResetConfirmView.as_view(), - name='reset-password-confirm'), + path('password/reset', + views.PasswordResetView.as_view(), + name='reset-password'), + path('password/reset/confirm', + views.PasswordResetConfirmView.as_view(), + name='reset-password-confirm'), path('token/create', views.TokenCreateView.as_view(), name='token-create'), - path( - 'token/destroy', - views.TokenDestroyView.as_view(), - name='token-destroy'), + path('token/destroy', + views.TokenDestroyView.as_view(), + name='token-destroy'), path('token/login', views.TokenCreateView.as_view(), name='login'), path('token/logout', views.TokenDestroyView.as_view(), name='logout'), ] diff --git a/hiber/apps/api/serializers.py b/hiber/apps/api/serializers.py index 11ef968..adb5a5a 100644 --- a/hiber/apps/api/serializers.py +++ b/hiber/apps/api/serializers.py @@ -64,13 +64,13 @@ class BatSerializer(serializers.ModelSerializer): # TODO: Get current image to display an absolute path over API id = serializers.ReadOnlyField() rarity = ChoiceField(choices=Bat.RARITY_CHOICES) - habits = serializers.ListField( - child=ChoiceField(choices=Bat.HABIT_CHOICES)) + habits = serializers.ListField(child=ChoiceField( + choices=Bat.HABIT_CHOICES)) size = FloatRangeField() pups = IntegerRangeField() risk = serializers.ListField(child=ChoiceField(choices=Bat.RISK_CHOICES)) - risk_scope = serializers.ListField( - child=ChoiceField(choices=Bat.SCOPE_CHOICES)) + risk_scope = serializers.ListField(child=ChoiceField( + choices=Bat.SCOPE_CHOICES)) bat_image = ImageRenditionField('fill-200x200') class Meta: @@ -89,8 +89,9 @@ class HouseSerializer(ConditionalRequiredMixin, serializers.ModelSerializer): location = PointField() property_type = ChoiceField( choices=House._meta.get_field('property_type').choices) - created = serializers.DateTimeField( - default=serializers.CreateOnlyDefault(timezone.now()), read_only=True) + created = serializers.DateTimeField(default=serializers.CreateOnlyDefault( + timezone.now()), + read_only=True) updated = serializers.DateTimeField(read_only=True) class Meta: @@ -125,28 +126,22 @@ class HouseEnvironmentFeaturesSerializer(ConditionalRequiredMixin, ] id = serializers.ReadOnlyField() house_id = serializers.ReadOnlyField() - habitat_degradation = serializers.ListField( - child=ChoiceField( - choices=HouseEnvironmentFeatures.HABITAT_DEGRADATION_CHOICES)) - habitat_type = serializers.ListField( - child=ChoiceField( - choices=HouseEnvironmentFeatures.HABITAT_TYPE_CHOICES)) - man_made_structure = serializers.ListField( - child=ChoiceField( - choices=HouseEnvironmentFeatures.MAN_MADE_STRUCTURE_CHOICES)) - nearby_geography = serializers.ListField( - child=ChoiceField( - choices=HouseEnvironmentFeatures.NEARBY_GEOGRAPHY_CHOICES)) + habitat_degradation = serializers.ListField(child=ChoiceField( + choices=HouseEnvironmentFeatures.HABITAT_DEGRADATION_CHOICES)) + habitat_type = serializers.ListField(child=ChoiceField( + choices=HouseEnvironmentFeatures.HABITAT_TYPE_CHOICES)) + man_made_structure = serializers.ListField(child=ChoiceField( + choices=HouseEnvironmentFeatures.MAN_MADE_STRUCTURE_CHOICES)) + nearby_geography = serializers.ListField(child=ChoiceField( + choices=HouseEnvironmentFeatures.NEARBY_GEOGRAPHY_CHOICES)) slope = ChoiceField( choices=HouseEnvironmentFeatures._meta.get_field('slope').choices) day_noise = ChoiceField( choices=HouseEnvironmentFeatures._meta.get_field('day_noise').choices) - night_noise = ChoiceField( - choices=HouseEnvironmentFeatures._meta.get_field( - 'night_noise').choices) - noise_disturbance = serializers.ListField( - child=ChoiceField( - choices=HouseEnvironmentFeatures.NOISE_DISTURBANCE_CHOICES)) + night_noise = ChoiceField(choices=HouseEnvironmentFeatures._meta.get_field( + 'night_noise').choices) + noise_disturbance = serializers.ListField(child=ChoiceField( + choices=HouseEnvironmentFeatures.NOISE_DISTURBANCE_CHOICES)) night_light_pollution_amount = ChoiceField( choices=HouseEnvironmentFeatures._meta.get_field( 'night_light_pollution_amount').choices) diff --git a/hiber/apps/api/urls.py b/hiber/apps/api/urls.py index 649d5e8..25dd1cd 100644 --- a/hiber/apps/api/urls.py +++ b/hiber/apps/api/urls.py @@ -23,10 +23,9 @@ router.register(r'houses', views.HouseViewSet) v1_urlpatterns = [ - path( - 'docs/', - schema_view.with_ui('redoc', cache_timeout=0), - name='schema-redoc'), + path('docs/', + schema_view.with_ui('redoc', cache_timeout=0), + name='schema-redoc'), url('^', include(router.urls)), ] diff --git a/hiber/apps/api/views.py b/hiber/apps/api/views.py index 959643f..805f718 100644 --- a/hiber/apps/api/views.py +++ b/hiber/apps/api/views.py @@ -8,9 +8,10 @@ from ..bathouse.models import (Bat, House, HouseEnvironmentFeatures, HousePhysicalFeatures, Observation) from .permissions import (IsOwnerAndAuthenticated) -from .serializers import ( - BatSerializer, HouseSerializer, HouseEnvironmentFeaturesSerializer, - HousePhysicalFeaturesSerializer, ObservationSerializer) +from .serializers import (BatSerializer, HouseSerializer, + HouseEnvironmentFeaturesSerializer, + HousePhysicalFeaturesSerializer, + ObservationSerializer) class BatViewSet(viewsets.ReadOnlyModelViewSet): @@ -31,10 +32,9 @@ def get_queryset(self, *args, **kwargs): def perform_create(self, serializer): serializer.save(watcher=self.request.user) - @action( - detail=True, - methods=['get', 'post'], - permission_classes=[IsOwnerAndAuthenticated]) + @action(detail=True, + methods=['get', 'post'], + permission_classes=[IsOwnerAndAuthenticated]) def environment(self, request, pk=None): """ Returns a list of all the environment features @@ -57,15 +57,13 @@ def environment(self, request, pk=None): data["house_id"] = house.id record = HouseEnvironmentFeatures(**data) record.save() - return Response( - HouseEnvironmentFeaturesSerializer(record).data, - status=status.HTTP_201_CREATED) + return Response(HouseEnvironmentFeaturesSerializer(record).data, + status=status.HTTP_201_CREATED) return HttpResponseServerError() - @action( - detail=True, - methods=['get', 'post'], - permission_classes=[IsOwnerAndAuthenticated]) + @action(detail=True, + methods=['get', 'post'], + permission_classes=[IsOwnerAndAuthenticated]) def physical(self, request, pk=None): """ Returns a list of all the physical features @@ -87,15 +85,13 @@ def physical(self, request, pk=None): data["house_id"] = house.id record = HousePhysicalFeatures(**data) record.save() - return Response( - HousePhysicalFeaturesSerializer(record).data, - status=status.HTTP_201_CREATED) + return Response(HousePhysicalFeaturesSerializer(record).data, + status=status.HTTP_201_CREATED) return HttpResponseServerError() - @action( - detail=True, - methods=['get', 'post'], - permission_classes=[IsOwnerAndAuthenticated]) + @action(detail=True, + methods=['get', 'post'], + permission_classes=[IsOwnerAndAuthenticated]) def observations(self, request, pk=None): """ Returns a list of all the observations the house has @@ -114,9 +110,8 @@ def observations(self, request, pk=None): data["house_id"] = house.id record = Observation(**data) record.save() - return Response( - ObservationSerializer(record).data, - status=status.HTTP_201_CREATED) + return Response(ObservationSerializer(record).data, + status=status.HTTP_201_CREATED) return HttpResponseServerError() diff --git a/hiber/apps/bathouse/migrations/0001_initial.py b/hiber/apps/bathouse/migrations/0001_initial.py index e67c223..f57d2e1 100644 --- a/hiber/apps/bathouse/migrations/0001_initial.py +++ b/hiber/apps/bathouse/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.1.7 on 2019-04-03 00:30 +# Generated by Django 2.1.7 on 2019-05-09 00:01 from django.conf import settings import django.contrib.gis.db.models.fields @@ -15,8 +15,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('wagtailimages', '0001_squashed_0021'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('wagtailimages', '0001_squashed_0021'), ] operations = [ @@ -54,7 +54,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('habitat_degradation', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('DU', 'Dumping'), ('ER', 'Erosion'), ('TR', 'Trash'), ('NO', 'None'), ('OT', 'Other')], max_length=2), help_text='Habitat degradation present around the bat house', size=None)), ('other_habitat_degradation', models.CharField(blank=True, help_text='Habitat degradation if Other was selected', max_length=255)), - ('habitat_type', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('DE', 'Development'), ('FE', 'Forest Edge'), ('FG', 'Forest Gap'), ('FI', 'Field'), ('SR', 'Stream/River'), ('WP', 'Wetland/Pond'), ('OT', 'Other')], max_length=2), help_text='Type of environment around the bat house', size=None)), + ('habitat_type', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('DE', 'Development'), ('FE', 'Forest Edge'), ('FG', 'Forest Gap'), ('FI', 'Field'), ('SR', 'Stream/River'), ('WP', 'Wetland/Pond'), ('OT', 'Other')], help_text='Type of environment around the bat house', max_length=2), size=None)), ('other_habitat_type', models.CharField(blank=True, help_text='Habitat type if Other was selected', max_length=255)), ('man_made_structure', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('BU', 'Building'), ('BR', 'Bridge'), ('DA', 'Dam'), ('DR', 'Dirt Road'), ('FE', 'Fence'), ('PR', 'Paved Roads'), ('TR', 'Trail'), ('NO', 'None'), ('OT', 'Other')], max_length=2), help_text='Man-made structures present around the bat house', size=None)), ('other_man_made_structure', models.CharField(blank=True, help_text='Man-made structures present if Other was selected', max_length=255)), @@ -87,7 +87,7 @@ class Migration(migrations.Migration): ('other_color', models.CharField(blank=True, help_text='Color of bat house if Other is specified', max_length=255)), ('chambers', models.PositiveIntegerField(help_text='Number of chambers in bat house', validators=[django.core.validators.MinValueValidator(1)])), ('direction', models.CharField(choices=[('NO', 'North'), ('NE', 'Northeast'), ('EA', 'East'), ('SE', 'Southeast'), ('SO', 'South'), ('SW', 'Southwest'), ('WE', 'West'), ('NW', 'Northwest')], help_text='Direction which bat house is facing', max_length=2)), - ('mounted_on', models.CharField(choices=[('BB', 'Back to back'), ('BD', 'Building'), ('PI', 'Pole by itself'), ('PI', 'Pole with another bat house'), ('TR', 'Tree'), ('OT', 'Other')], help_text='Item which bat house is mounted to', max_length=2)), + ('mounted_on', models.CharField(choices=[('BD', 'Building'), ('PI', 'On a pole by itself'), ('PB', 'On a pole with another bat house, back to back'), ('TR', 'Tree'), ('OT', 'Other')], help_text='Item which bat house is mounted to', max_length=2)), ('other_mounted_on', models.CharField(blank=True, help_text='Mount type if Other is specified', max_length=255)), ('ground_height', models.PositiveIntegerField(help_text='Height above the ground surface (in feet)', validators=[django.core.validators.MinValueValidator(1)])), ('installed', models.DateField(help_text='Date when the bat house was installed')), @@ -98,7 +98,7 @@ class Migration(migrations.Migration): name='Observation', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('checked', models.DateTimeField(help_text='Date and when the bat house was checked')), + ('checked', models.DateTimeField(help_text='Date and time when the bat house was checked')), ('present', models.BooleanField(help_text='True if bats were there, False otherwise', verbose_name='bat presence')), ('occupants', models.IntegerField(blank=True, help_text='Amount of bats present in the bat house')), ('acoustic_monitor', models.CharField(choices=[('Y', 'Yes'), ('N', 'No'), ('U', 'Unsure')], help_text='Has a bat biologist came to setup acoustic monitoring around the bat house?', max_length=1)), diff --git a/hiber/apps/bathouse/migrations/0002_auto_20190430_1729.py b/hiber/apps/bathouse/migrations/0002_auto_20190430_1729.py deleted file mode 100644 index 5a7a047..0000000 --- a/hiber/apps/bathouse/migrations/0002_auto_20190430_1729.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 2.1.7 on 2019-04-30 21:29 - -import django.contrib.postgres.fields -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('bathouse', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='houseenvironmentfeatures', - name='habitat_type', - field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('DE', 'Development'), ('FE', 'Forest Edge'), ('FG', 'Forest Gap'), ('FI', 'Field'), ('SR', 'Stream/River'), ('WP', 'Wetland/Pond'), ('OT', 'Other')], help_text='Type of environment around the bat house', max_length=2), size=None), - ), - migrations.AlterField( - model_name='housephysicalfeatures', - name='mounted_on', - field=models.CharField(choices=[('BD', 'Building'), ('PI', 'On a pole by itself'), ('PB', 'On a pole with another bat house, back to back'), ('TR', 'Tree'), ('OT', 'Other')], help_text='Item which bat house is mounted to', max_length=2), - ), - migrations.AlterField( - model_name='observation', - name='checked', - field=models.DateTimeField(help_text='Date and time when the bat house was checked'), - ), - ] diff --git a/hiber/apps/bathouse/models.py b/hiber/apps/bathouse/models.py index 25f6c20..39429e7 100644 --- a/hiber/apps/bathouse/models.py +++ b/hiber/apps/bathouse/models.py @@ -35,18 +35,17 @@ class Bat(models.Model): This is consumed on the front-end to show species of bats to the user, as well as a way to tag what bats were seen at a particular House. """ - common_name = models.CharField( - max_length=255, help_text="Name used in everyday life") + common_name = models.CharField(max_length=255, + help_text="Name used in everyday life") scientific_name = models.CharField( max_length=255, help_text="Formal system used for naming species") RARITY_CHOICES = (('CO', 'Common'), ('SC', 'Seasonally Common'), ('RA', 'Rare')) - rarity = models.CharField( - max_length=2, - choices=RARITY_CHOICES, - default='CO', - help_text="How often the species is seen") + rarity = models.CharField(max_length=2, + choices=RARITY_CHOICES, + default='CO', + help_text="How often the species is seen") HABIT_CHOICES = (('HI', 'Hibernates'), ('MI', 'Migrates'), ('CR', 'Cave roosts'), ('TR', 'Tree roosts')) @@ -60,10 +59,10 @@ class Bat(models.Model): RISK_CHOICES = (('NT', 'Not threatened'), ('EN', 'Endangered'), ('TH', 'Threatened'), ('SC', 'Special concern')) - risk = ChoiceArrayField( - models.CharField(max_length=2, choices=RISK_CHOICES), - blank=True, - help_text="Conservation status for the species") + risk = ChoiceArrayField(models.CharField(max_length=2, + choices=RISK_CHOICES), + blank=True, + help_text="Conservation status for the species") SCOPE_CHOICES = (('ST', 'State'), ('FE', 'Federally')) risk_scope = ChoiceArrayField( @@ -88,17 +87,15 @@ class Bat(models.Model): classname="collapsible"), MultiFieldPanel([ FieldPanel('rarity', classname="col12"), - FieldPanel( - 'habits', - classname="col12", - widget=forms.CheckboxSelectMultiple), - FieldPanel( - 'risk', classname="col12", - widget=forms.CheckboxSelectMultiple), - FieldPanel( - 'risk_scope', - classname="col12", - widget=forms.CheckboxSelectMultiple), + FieldPanel('habits', + classname="col12", + widget=forms.CheckboxSelectMultiple), + FieldPanel('risk', + classname="col12", + widget=forms.CheckboxSelectMultiple), + FieldPanel('risk_scope', + classname="col12", + widget=forms.CheckboxSelectMultiple), ], heading="Information", classname="collapsible"), @@ -136,11 +133,10 @@ class House(models.Model): location = models.PointField( help_text="Point that indicates where the bat house is located", verbose_name="geographical location") - town_name = models.CharField( - blank=True, - max_length=255, - help_text="Town where bat house is located", - verbose_name="town location") + town_name = models.CharField(blank=True, + max_length=255, + help_text="Town where bat house is located", + verbose_name="town location") property_type = models.CharField( default='OT', max_length=2, @@ -151,10 +147,10 @@ class House(models.Model): max_length=255, blank=True, help_text="Property type if Other was selected") - created = models.DateTimeField( - auto_now_add=True, help_text="Date when House was created") - updated = models.DateTimeField( - auto_now=True, help_text="Date when House was updated") + created = models.DateTimeField(auto_now_add=True, + help_text="Date when House was created") + updated = models.DateTimeField(auto_now=True, + help_text="Date when House was updated") class HouseEnvironmentFeatures(models.Model): @@ -164,8 +160,9 @@ class HouseEnvironmentFeatures(models.Model): structures, geography, noise nearby, light created, water sources, and sunlight. """ - house = models.ForeignKey( - House, on_delete=models.CASCADE, related_name='environment_features') + house = models.ForeignKey(House, + on_delete=models.CASCADE, + related_name='environment_features') # Standing under the bat house and looking in all directions, select all... HABITAT_DEGRADATION_CHOICES = ( @@ -176,23 +173,21 @@ class HouseEnvironmentFeatures(models.Model): ('OT', 'Other'), ) habitat_degradation = ArrayField( - base_field=models.CharField( - max_length=2, choices=HABITAT_DEGRADATION_CHOICES), + base_field=models.CharField(max_length=2, + choices=HABITAT_DEGRADATION_CHOICES), help_text="Habitat degradation present around the bat house") other_habitat_degradation = models.CharField( max_length=255, blank=True, help_text="Habitat degradation if Other was selected") HABITAT_TYPE_CHOICES = (('DE', 'Development'), ('FE', 'Forest Edge'), - ('FG', 'Forest Gap'), ('FI', - 'Field'), ('SR', - 'Stream/River'), - ('WP', 'Wetland/Pond'), ('OT', 'Other')) - habitat_type = ArrayField( - base_field=models.CharField( - max_length=2, - choices=HABITAT_TYPE_CHOICES, - help_text="Type of environment around the bat house")) + ('FG', 'Forest Gap'), ('FI', 'Field'), + ('SR', 'Stream/River'), ('WP', 'Wetland/Pond'), + ('OT', 'Other')) + habitat_type = ArrayField(base_field=models.CharField( + max_length=2, + choices=HABITAT_TYPE_CHOICES, + help_text="Type of environment around the bat house")) other_habitat_type = models.CharField( max_length=255, blank=True, @@ -209,8 +204,8 @@ class HouseEnvironmentFeatures(models.Model): ('OT', 'Other'), ) man_made_structure = ArrayField( - base_field=models.CharField( - max_length=2, choices=MAN_MADE_STRUCTURE_CHOICES), + base_field=models.CharField(max_length=2, + choices=MAN_MADE_STRUCTURE_CHOICES), help_text="Man-made structures present around the bat house") other_man_made_structure = models.CharField( max_length=255, @@ -220,18 +215,17 @@ class HouseEnvironmentFeatures(models.Model): ('RI', 'Ridgetop'), ('PL', 'Plane (Flat Area)')) nearby_geography = ArrayField( - base_field=models.CharField( - max_length=2, choices=NEARBY_GEOGRAPHY_CHOICES), + base_field=models.CharField(max_length=2, + choices=NEARBY_GEOGRAPHY_CHOICES), help_text="Nearby geography of the area around the bat house") - slope = models.CharField( - max_length=1, - choices=( - ('F', 'Flat'), - ('G', 'Gentle'), - ('U', 'Undulating'), - ('S', 'Steep'), - ), - help_text="Type of slope the bat house is on") + slope = models.CharField(max_length=1, + choices=( + ('F', 'Flat'), + ('G', 'Gentle'), + ('U', 'Undulating'), + ('S', 'Steep'), + ), + help_text="Type of slope the bat house is on") tree_type = models.IntegerField( validators=[MinValueValidator(0), MaxValueValidator(5)], @@ -262,8 +256,8 @@ class HouseEnvironmentFeatures(models.Model): ('OT', 'Other'), ) noise_disturbance = ArrayField( - base_field=models.CharField( - max_length=2, choices=NOISE_DISTURBANCE_CHOICES), + base_field=models.CharField(max_length=2, + choices=NOISE_DISTURBANCE_CHOICES), help_text="Noise disturbances around the bat house") other_noise_disturbance = models.CharField( max_length=255, @@ -331,8 +325,9 @@ class HousePhysicalFeatures(models.Model): Describes a model that has all information regarding the physical characteristics of the bat house, including size, amount of chambers, etc. """ - house = models.ForeignKey( - House, on_delete=models.CASCADE, related_name='physical_features') + house = models.ForeignKey(House, + on_delete=models.CASCADE, + related_name='physical_features') house_size = models.CharField( max_length=1, @@ -342,19 +337,18 @@ class HousePhysicalFeatures(models.Model): ('L', 'Large'), ), help_text="Approximate size of the bat house") - color = models.CharField( - max_length=2, - choices=( - ('BL', 'Black'), - ('DB', 'Dark brown'), - ('MB', 'Medium brown'), - ('LB', 'Light brown'), - ('TB', 'Tan/Beige'), - ('NW', 'Natural wood'), - ('WH', 'White'), - ('OT', 'Other'), - ), - help_text="Color of bat house") + color = models.CharField(max_length=2, + choices=( + ('BL', 'Black'), + ('DB', 'Dark brown'), + ('MB', 'Medium brown'), + ('LB', 'Light brown'), + ('TB', 'Tan/Beige'), + ('NW', 'Natural wood'), + ('WH', 'White'), + ('OT', 'Other'), + ), + help_text="Color of bat house") other_color = models.CharField( blank=True, max_length=255, @@ -401,8 +395,9 @@ class Observation(models.Model): Describes a model that a user will submit about observations for the presence of bats in their bat house. """ - house = models.ForeignKey( - House, on_delete=models.CASCADE, related_name="observations") + house = models.ForeignKey(House, + on_delete=models.CASCADE, + related_name="observations") checked = models.DateTimeField( help_text="Date and time when the bat house was checked") @@ -416,5 +411,5 @@ class Observation(models.Model): choices=(('Y', 'Yes'), ('N', 'No'), ('U', 'Unsure')), help_text="Has a bat biologist came to setup acoustic monitoring around \ the bat house?") - notes = models.TextField( - blank=True, help_text="Other notes about observations") + notes = models.TextField(blank=True, + help_text="Other notes about observations") diff --git a/hiber/urls.py b/hiber/urls.py index 0dafb62..5838aa3 100644 --- a/hiber/urls.py +++ b/hiber/urls.py @@ -36,5 +36,5 @@ # Serve static and media files from development server urlpatterns += staticfiles_urlpatterns() - urlpatterns += static( - settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # noqa + urlpatterns += static(settings.MEDIA_URL, + document_root=settings.MEDIA_ROOT) # noqa diff --git a/requirements/development.txt b/requirements/development.txt index 62b2a64..6d20b0b 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -3,5 +3,5 @@ tox>=3.7,<3.8 pytest>=4.3,<4.4 pytest-django>=3.4,<3.5 flake8>=3.7,<3.8 -yapf>=0.26,<0.27 +yapf>=0.27,<0.28 django-extensions>=2.1.0,<2.2.0 \ No newline at end of file diff --git a/tox.ini b/tox.ini index 487b8c2..64f3504 100644 --- a/tox.ini +++ b/tox.ini @@ -17,8 +17,8 @@ commands = [testenv:qa] deps = - flake8 - yapf + flake8 <3.8 + yapf <0.28 commands = flake8 yapf -d --recursive {toxinidir}/hiber