浏览代码

normalize on double quote for dosctrings versus single quote

David Ray 8 年之前
父节点
当前提交
df399f5869
共有 4 个文件被更改,包括 30 次插入30 次删除
  1. 12 12
      bakerydemo/blog/models.py
  2. 8 8
      bakerydemo/breads/models.py
  3. 8 8
      bakerydemo/locations/models.py
  4. 2 2
      bakerydemo/search/views.py

+ 12 - 12
bakerydemo/blog/models.py

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

+ 8 - 8
bakerydemo/breads/models.py

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

+ 8 - 8
bakerydemo/locations/models.py

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

+ 2 - 2
bakerydemo/search/views.py

@@ -13,13 +13,13 @@ def search(request):
     # Search
     # Search
     search_query = request.GET.get('query', None)
     search_query = request.GET.get('query', None)
     if search_query:
     if search_query:
-        '''
+        """
         Because we can't use ElasticSearch for the demo, we use the native db search.
         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.
         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.
         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
         In production, use ElasticSearch and a simplified search query, per
         http://docs.wagtail.io/en/v1.8.1/topics/search/searching.html
         http://docs.wagtail.io/en/v1.8.1/topics/search/searching.html
-        '''
+        """
 
 
         blog_results = BlogPage.objects.live().search(search_query)
         blog_results = BlogPage.objects.live().search(search_query)
         blog_page_ids = [p.page_ptr.id for p in blog_results]
         blog_page_ids = [p.page_ptr.id for p in blog_results]