Typos and missing docstrings.

This commit is contained in:
2020-09-21 21:37:28 +02:00
parent 85a34b20f9
commit 9632040ade
11 changed files with 43 additions and 32 deletions
+2 -2
View File
@@ -19,9 +19,9 @@ class ExplorerCreationForm(UserCreationForm):
def is_valid(self):
super().is_valid()
sumitted_voucher = self.cleaned_data.get('voucher')
submitted_voucher = self.cleaned_data.get('voucher')
try:
fetched_voucher = Voucher.objects.get(code=sumitted_voucher)
fetched_voucher = Voucher.objects.get(code=submitted_voucher)
except Voucher.DoesNotExist:
self.add_error('voucher', 'Invalid voucher')
return False
+3 -3
View File
@@ -48,7 +48,7 @@ def save_user_profile(sender, instance, **kwargs):
class Taggable(models.Model):
'''
This abstract model represtens an object that is taggalble
This abstract model represtens an object that is taggable
using django-taggit
'''
class Meta:
@@ -150,7 +150,7 @@ class Place(Submittable, Taggable, Mapable):
def generate_image_upload_path(instance, filename):
"""
Callback for generating path for uploaded images.
Returns filename as: placepk-placename{-rndstring}.jpg
Returns filename as: place_pk-placename{-rnd_string}.jpg
"""
return 'places/' + str(instance.place.pk) + '-' + str(instance.place.name) + '.' + filename.split('.')[-1]
@@ -178,7 +178,7 @@ class PlaceImage (Submittable):
def __str__(self):
"""
Returning the name of the corresponding place + id
of this image as textual represntation of this instance
of this image as textual representation of this instance
"""
return 'Image ' + str(self.pk)
@@ -0,0 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
@@ -1,3 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import template
register = template.Library()
@@ -1,3 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json, os
from importlib import import_module
@@ -45,7 +45,7 @@ class PlaceTestCase(ModelTestCase):
max_length=100
)
def test_decsription(self):
def test_description(self):
self.assertField('description', models.TextField)
def test_average_latlon(self):
@@ -112,7 +112,7 @@ class PlaceTestCase(ModelTestCase):
)
)
self.assertEqual(avg_latlon['longitude'], 0,
msg='%s: a(no places) verage longitude missmatch' % (
msg='%s: (no places) average longitude missmatch' % (
self.model.__name__
)
)
@@ -10,7 +10,7 @@ from lostplaces.models import Voucher
from lostplaces.tests.models import ModelTestCase
class VoucheTestCase(ModelTestCase):
class VoucherTestCase(ModelTestCase):
model = Voucher
@classmethod
@@ -9,7 +9,7 @@ from taggit.models import Tag
class ViewTestCase(TestCase):
'''
This is a mixni for testing views. It provides functionality to
This is a Mixin for testing views. It provides functionality to
test the context, forms and HTTP Response of responses.
All methods take responses, so this base class can be used
with django's RequestFactory and Test-Client
@@ -71,7 +71,7 @@ class ViewTestCase(TestCase):
def assertHttpRedirect(self, response, redirect_to=None):
'''
Checks weather the response redirected, and if passed,
if it redirected to the expected loaction
if it redirected to the expected location
'''
self.assertTrue(
@@ -87,7 +87,7 @@ class ViewTestCase(TestCase):
self.assertEqual(
response['location'],
redirect_to,
msg='Expecing the response to redirect to %s, where redirected to %s instea' % (
msg='Expecting the response to redirect to %s, where redirected to %s instea' % (
str(redirect_to),
str(response['location'])
)
@@ -16,7 +16,7 @@ from lostplaces.models import Place
class IsAuthenticatedMixin(LoginRequiredMixin, View):
'''
A view mixin that checks wether a user is loged in or not.
A view mixin that checks wether a user is logged in or not.
If the user is not logged in, he gets redirected to
the login page.
'''
@@ -29,9 +29,9 @@ class IsAuthenticatedMixin(LoginRequiredMixin, View):
class IsPlaceSubmitterMixin(UserPassesTestMixin, View):
'''
A view mixin that checks wethe a user is the submitter
of a place Throws 403 if the user is not. The subclass
has to provide a get_place method, wich returns the
A view mixin that checks wether a user is the submitter
of a place, throws 403 if the user is not. The subclass
has to provide a get_place method, which returns the
place to check.
'''
place_submitter_error_message = None