Renaming MapablePoint

This commit is contained in:
reverend 2020-09-14 15:18:21 +02:00
parent 79ed029db0
commit 12881d9345
4 changed files with 13 additions and 13 deletions

View File

@ -54,7 +54,7 @@ class Taggable(models.Model):
tags = TaggableManager(blank=True) tags = TaggableManager(blank=True)
class MapablePoint(models.Model): class Mapable(models.Model):
''' '''
This abstract model class represents an object that can be This abstract model class represents an object that can be
displayed on a map. displayed on a map.
@ -109,7 +109,7 @@ class Voucher(models.Model):
return "Voucher " + str(self.code) return "Voucher " + str(self.code)
class Place(Submittable, Taggable, MapablePoint): class Place(Submittable, Taggable, Mapable):
""" """
Place defines a lost place (location, name, description etc.). Place defines a lost place (location, name, description etc.).
""" """

View File

@ -6,7 +6,7 @@ from django.contrib.auth.models import User
from lostplaces_app.models import ( from lostplaces_app.models import (
Taggable, Taggable,
MapablePoint, Mapable,
Submittable Submittable
) )
from lostplaces_app.tests.models import ModelTestCase from lostplaces_app.tests.models import ModelTestCase
@ -22,9 +22,9 @@ class TaggableTestCase(ModelTestCase):
self.assertField('tags', TaggableManager) self.assertField('tags', TaggableManager)
class MapablePointTestCase(ModelTestCase): class MapableTestCase(ModelTestCase):
model = MapablePoint model = Mapable
def test_name(self): def test_name(self):
self.assertCharField( self.assertCharField(

View File

@ -1,6 +1,6 @@
from django.test import TestCase from django.test import TestCase
from lostplaces_app.models import Taggable, MapablePoint from lostplaces_app.models import Taggable, Mapable
from taggit.models import Tag from taggit.models import Tag
@ -165,9 +165,9 @@ class TaggableViewTestCaseMixin:
msg='Expecting delete_url_name to be of type string' msg='Expecting delete_url_name to be of type string'
) )
class MapablePointViewTestCaseMixin: class MapableViewTestCaseMixin:
def assertMapablePointContext(self, context): def assertMapableContext(self, context):
self.assertTrue( self.assertTrue(
'all_points' in context, 'all_points' in context,
msg='Expecting the context for mapable point to contain \'all_points\' attribute' msg='Expecting the context for mapable point to contain \'all_points\' attribute'
@ -175,9 +175,9 @@ class MapablePointViewTestCaseMixin:
for point in context['all_points']: for point in context['all_points']:
self.assertTrue( self.assertTrue(
isinstance(point, MapablePoint), isinstance(point, Mapable),
msg='Expecting all entries to be an instance of %s, got %s' % ( msg='Expecting all entries to be an instance of %s, got %s' % (
str(MapablePoint), str(Mapable),
str(type(point)) str(type(point))
) )
) )

View File

@ -14,7 +14,7 @@ from lostplaces_app.forms import PlaceImageCreateForm, PlaceForm
from lostplaces_app.tests.views import ( from lostplaces_app.tests.views import (
ViewTestCase, ViewTestCase,
TaggableViewTestCaseMixin, TaggableViewTestCaseMixin,
MapablePointViewTestCaseMixin MapableViewTestCaseMixin
) )
@ -83,7 +83,7 @@ class TestPlaceListView(ViewTestCase):
self.assertContext(response, 'mapping_config') self.assertContext(response, 'mapping_config')
class PlaceDetailViewTestCase(TaggableViewTestCaseMixin, MapablePointViewTestCaseMixin, ViewTestCase): class PlaceDetailViewTestCase(TaggableViewTestCaseMixin, MapableViewTestCaseMixin, ViewTestCase):
view = PlaceDetailView view = PlaceDetailView
@classmethod @classmethod
@ -123,4 +123,4 @@ class PlaceDetailViewTestCase(TaggableViewTestCaseMixin, MapablePointViewTestCas
str(self.view) str(self.view)
) )
) )
self.assertMapablePointContext(response.context['mapping_config']) self.assertMapableContext(response.context['mapping_config'])