mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Use os.path.splitext() instead of custom logic
This commit is contained in:
parent
8bf9851e01
commit
86f6287202
@ -40,11 +40,7 @@ class Document(models.Model, TagSearchable):
|
||||
|
||||
@property
|
||||
def file_extension(self):
|
||||
parts = self.filename.split('.')
|
||||
if len(parts) > 1:
|
||||
return parts[-1]
|
||||
else:
|
||||
return ''
|
||||
return os.path.splitext(self.filename)[1][1:]
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
|
Loading…
Reference in New Issue
Block a user