Skip to content

Commit

Permalink
Fix minor code formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Mar 11, 2019
1 parent b205db3 commit e444dda
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
10 changes: 6 additions & 4 deletions djangocms_page_meta/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ def copy_relations(self, oldinstance, language):
@python_2_unicode_compatible
class GenericMetaAttribute(models.Model):
DEFAULT_ATTRIBUTE = 'name'
page = models.ForeignKey(PageMeta, null=True, blank=True, related_name='extra',
on_delete=models.CASCADE)
title = models.ForeignKey(TitleMeta, null=True, blank=True, related_name='extra',
on_delete=models.CASCADE)
page = models.ForeignKey(
PageMeta, null=True, blank=True, related_name='extra', on_delete=models.CASCADE
)
title = models.ForeignKey(
TitleMeta, null=True, blank=True, related_name='extra', on_delete=models.CASCADE
)
attribute = models.CharField(
_('attribute'), max_length=200, help_text=_('Custom attribute'), default='', blank=True,
)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_page_meta_og(self):
"""
Tests the OpenGraph meta tags
"""
page, _ = self.get_pages()
page, __ = self.get_pages()
page_meta = models.PageMeta.objects.create(extended_object=page)
for key, val in self.page_data.items():
setattr(page_meta, key, val)
Expand Down Expand Up @@ -63,7 +63,7 @@ def test_page_meta_twitter(self):
"""
Tests the Twitter cards
"""
page, _ = self.get_pages()
page, __ = self.get_pages()
page_meta = models.PageMeta.objects.create(extended_object=page)
for key, val in self.page_data.items():
setattr(page_meta, key, val)
Expand All @@ -83,7 +83,7 @@ def test_page_meta_gplus(self):
"""
Tests the Google+ schema data
"""
page, _ = self.get_pages()
page, __ = self.get_pages()
page_meta = models.PageMeta.objects.create(extended_object=page)
for key, val in self.page_data.items():
setattr(page_meta, key, val)
Expand Down Expand Up @@ -120,7 +120,7 @@ def test_page_meta_no_meta(self):
Tests the meta if no PageMeta is set
"""
meta_settings.GPLUS_AUTHOR = self.gplus_data['gplus_author']
page, _ = self.get_pages()
page, __ = self.get_pages()

meta = get_page_meta(page, 'en')
self.assertEqual(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_templatetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_page_meta(self):
"""
Test page-level templatetags
"""
page1, _ = self.get_pages()
page1, __ = self.get_pages()
page_ext = PageMeta.objects.create(extended_object=page1)
for key, val in self.og_data.items():
setattr(page_ext, key, val)
Expand All @@ -39,7 +39,7 @@ def test_title_meta(self):
"""
Test title-level templatetags
"""
page1, _ = self.get_pages()
page1, __ = self.get_pages()
title_en = page1.get_title_obj(language='en', fallback=False)
title_it = page1.get_title_obj(language='it', fallback=False)
title_ext = TitleMeta.objects.create(extended_object=title_en)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_no_perm(self):
Test that no page menu is present if user has no perm
"""
from cms.toolbar.toolbar import CMSToolbar
page1, _ = self.get_pages()
page1, __ = self.get_pages()
request = self.get_page_request(page1, self.user_staff, '/', edit=True)
toolbar = CMSToolbar(request)
toolbar.get_left_items()
Expand All @@ -52,7 +52,7 @@ def test_perm(self):
Test that page meta menu is present if user has Page.change_perm
"""
from cms.toolbar.toolbar import CMSToolbar
page1, _ = self.get_pages()
page1, __ = self.get_pages()
self.user_staff.user_permissions.add(Permission.objects.get(codename='change_page'))
self.user_staff = User.objects.get(pk=self.user_staff.pk)
request = self.get_page_request(page1, self.user_staff, '/', edit=True)
Expand All @@ -68,7 +68,7 @@ def test_perm_permissions(self):
Test that no page menu is present if user has general page Page.change_perm but not permission on current page
"""
from cms.toolbar.toolbar import CMSToolbar
page1, _ = self.get_pages()
page1, __ = self.get_pages()
self.user_staff.user_permissions.add(Permission.objects.get(codename='change_page'))
self.user_staff = User.objects.get(pk=self.user_staff.pk)
request = self.get_page_request(page1, self.user_staff, '/', edit=True)
Expand Down Expand Up @@ -104,7 +104,7 @@ def test_toolbar(self):
},
}

page1, _ = self.get_pages()
page1, __ = self.get_pages()
with self.settings(CMS_LANGUAGES=NEW_CMS_LANGS):
request = self.get_page_request(page1, self.user, '/', edit=True)
toolbar = CMSToolbar(request)
Expand All @@ -119,7 +119,7 @@ def test_toolbar_with_items(self):
Test that PageMeta/TitleMeta items are present for superuser if PageMeta/TitleMeta exists for current page
"""
from cms.toolbar.toolbar import CMSToolbar
page1, _ = self.get_pages()
page1, __ = self.get_pages()
page_ext = PageMeta.objects.create(extended_object=page1)
title_meta = TitleMeta.objects.create(extended_object=page1.get_title_obj('en'))
request = self.get_page_request(page1, self.user, '/', edit=True)
Expand Down

0 comments on commit e444dda

Please sign in to comment.