Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mateusz Marzantowicz
committed
Aug 8, 2014
1 parent
0326088
commit e7b4a6d
Showing
10 changed files
with
111 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
from cms.models import CMSPlugin, Placeholder | ||
from cms.utils.compat.dj import python_2_unicode_compatible | ||
from django.utils.encoding import force_text | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models | ||
from django.utils.encoding import python_2_unicode_compatible | ||
|
||
from cms.models import CMSPlugin, Placeholder | ||
|
||
|
||
@python_2_unicode_compatible | ||
class AliasPluginModel(CMSPlugin): | ||
plugin = models.ForeignKey(CMSPlugin, editable=False, related_name="alias_reference", null=True) | ||
alias_placeholder = models.ForeignKey(Placeholder, editable=False, related_name="alias_placeholder", null=True) | ||
plugin = models.ForeignKey(CMSPlugin, editable=False, null=True, related_name='alias_reference') | ||
alias_placeholder = models.ForeignKey(Placeholder, editable=False, null=True, related_name='alias_placeholder') | ||
|
||
class Meta: | ||
app_label = 'cms' | ||
|
||
def __str__(self): | ||
if self.plugin_id: | ||
return force_text(self.plugin.get_plugin_name()) | ||
return self.plugin.get_plugin_name() | ||
else: | ||
return force_text(self.alias_placeholder.get_label()) | ||
return self.alias_placeholder.get_label() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.