Skip to content

Commit 76fac79

Browse files
vstoykovFinalAngel
authored andcommitted
Add abstract models for File and Folder (#33)
1 parent bdd3028 commit 76fac79

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

djangocms_file/models.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def get_templates():
3535

3636

3737
@python_2_unicode_compatible
38-
class File(CMSPlugin):
38+
class AbstractFile(CMSPlugin):
3939
"""
4040
Renders a file wrapped by an anchor
4141
"""
@@ -95,6 +95,9 @@ class File(CMSPlugin):
9595
on_delete=models.CASCADE,
9696
)
9797

98+
class Meta:
99+
abstract = True
100+
98101
def __str__(self):
99102
if self.file_src and self.file_src.label:
100103
return self.file_src.label
@@ -114,7 +117,7 @@ def copy_relations(self, oldinstance):
114117

115118

116119
@python_2_unicode_compatible
117-
class Folder(CMSPlugin):
120+
class AbstractFolder(CMSPlugin):
118121
"""
119122
Renders a folder plugin to the selected tempalte
120123
"""
@@ -161,6 +164,9 @@ class Folder(CMSPlugin):
161164
on_delete=models.CASCADE,
162165
)
163166

167+
class Meta:
168+
abstract = True
169+
164170
def __str__(self):
165171
if self.folder_src and self.folder_src.name:
166172
return self.folder_src.name
@@ -182,3 +188,15 @@ def get_files(self):
182188
for folder in self.folder_src.files:
183189
folder_files.append(folder)
184190
return folder_files
191+
192+
193+
class File(AbstractFile):
194+
195+
class Meta:
196+
abstract = False
197+
198+
199+
class Folder(AbstractFolder):
200+
201+
class Meta:
202+
abstract = False

0 commit comments

Comments
 (0)