2
0
Эх сурвалжийг харах

normalize on double quote for dosctrings versus single quote

David Ray 8 жил өмнө
parent
commit
df399f5869

+ 12 - 12
bakerydemo/blog/models.py

@@ -23,10 +23,10 @@ from bakerydemo.base.blocks import BaseStreamBlock
 
 
 class BlogPeopleRelationship(Orderable, models.Model):
-    '''
+    """
     This defines the relationship between the `People` within the `base`
     app and the BlogPage below allowing us to add people to a BlogPage.
-    '''
+    """
     page = ParentalKey(
         'BlogPage', related_name='blog_person_relationship'
     )
@@ -43,9 +43,9 @@ class BlogPageTag(TaggedItemBase):
 
 
 class BlogPage(Page):
-    '''
+    """
     A Blog Page (Post)
-    '''
+    """
     image = models.ForeignKey(
         'wagtailimages.Image',
         null=True,
@@ -79,9 +79,9 @@ class BlogPage(Page):
     ]
 
     def authors(self):
-        '''
+        """
         Returns the BlogPage's related People
-        '''
+        """
         authors = [
             n.people for n in self.blog_person_relationship.all()
         ]
@@ -90,10 +90,10 @@ class BlogPage(Page):
 
     @property
     def get_tags(self):
-        '''
+        """
         Returns the BlogPage's related list of Tags.
         Each Tag is modified to include a url attribute
-        '''
+        """
         tags = self.tags.all()
         for tag in tags:
             tag.url = '/'+'/'.join(s.strip('/') for s in [
@@ -114,13 +114,13 @@ class BlogPage(Page):
 
 
 class BlogIndexPage(RoutablePageMixin, Page):
-    '''
+    """
     Index page for blogs.
     We need to alter the page model's context to return the child page objects - the
     BlogPage - so that it works as an index page
 
     The RoutablePageMixin is used to allow for a custom sub-URL
-    '''
+    """
     image = models.ForeignKey(
         'wagtailimages.Image',
         null=True,
@@ -157,11 +157,11 @@ class BlogIndexPage(RoutablePageMixin, Page):
     @route('^tags/$', name='tag_archive')
     @route('^tags/(\w+)/$', name='tag_archive')
     def tag_archive(self, request, tag=None):
-        '''
+        """
         A Custom view that utilizes Tags. This view will
         return all related BlogPages for a given Tag or redirect back to
         the BlogIndexPage
-        '''
+        """
         try:
             tag = Tag.objects.get(slug=tag)
         except Tag.DoesNotExist:

+ 8 - 8
bakerydemo/breads/models.py

@@ -12,10 +12,10 @@ from wagtail.wagtailsnippets.models import register_snippet
 
 @register_snippet
 class Country(models.Model):
-    '''
+    """
     Standard Django model to store set of countries of origin.
     Exposed in the Wagtail admin via Snippets.
-    '''
+    """
 
     title = models.CharField(max_length=100)
 
@@ -28,9 +28,9 @@ class Country(models.Model):
 
 @register_snippet
 class BreadType(models.Model):
-    '''
+    """
     Standard Django model used as a Snippet in the BreadPage model.
-    '''
+    """
 
     title = models.CharField(max_length=255)
 
@@ -46,9 +46,9 @@ class BreadType(models.Model):
 
 
 class BreadPage(Page):
-    '''
+    """
     Detail view for a specific bread
-    '''
+    """
 
     origin = models.ForeignKey(
         Country,
@@ -93,11 +93,11 @@ class BreadPage(Page):
 
 
 class BreadsIndexPage(Page):
-    '''
+    """
     Index page for breads. We don't have any fields within our model but we need
     to alter the page model's context to return the child page objects - the
     BreadPage - so that it works as an index page
-    '''
+    """
 
     subpage_types = ['BreadPage']
 

+ 8 - 8
bakerydemo/locations/models.py

@@ -9,9 +9,9 @@ from wagtail.wagtailsearch import index
 
 
 class OperatingHours(models.Model):
-    '''
+    """
     Django model to capture operating hours for a Location
-    '''
+    """
     MONDAY = 'MON'
     TUESDAY = 'TUE'
     WEDNESDAY = 'WED'
@@ -52,9 +52,9 @@ class OperatingHours(models.Model):
 
 
 class LocationOperatingHours(Orderable, OperatingHours):
-    '''
+    """
     Operating Hours entry for a Location
-    '''
+    """
     location = ParentalKey(
         'LocationPage',
         related_name='hours_of_operation'
@@ -62,9 +62,9 @@ class LocationOperatingHours(Orderable, OperatingHours):
 
 
 class LocationsIndexPage(Page):
-    '''
+    """
     Index page for locations
-    '''
+    """
 
     subpage_types = ['LocationPage']
 
@@ -77,9 +77,9 @@ class LocationsIndexPage(Page):
 
 
 class LocationPage(Page):
-    '''
+    """
     Detail for a specific location
-    '''
+    """
 
     address = models.TextField()
     image = models.ForeignKey(

+ 2 - 2
bakerydemo/search/views.py

@@ -13,13 +13,13 @@ def search(request):
     # Search
     search_query = request.GET.get('query', None)
     if search_query:
-        '''
+        """
         Because we can't use ElasticSearch for the demo, we use the native db search.
         But native DB search can't search specific fields in our models on a `Page` query.
         So for demo purposes ONLY, we hard-code in the model names we want to search.
         In production, use ElasticSearch and a simplified search query, per
         http://docs.wagtail.io/en/v1.8.1/topics/search/searching.html
-        '''
+        """
 
         blog_results = BlogPage.objects.live().search(search_query)
         blog_page_ids = [p.page_ptr.id for p in blog_results]