Fix a bug in tag deletion and category deletion. Avoid double slash on image URL
This commit is contained in:
parent
3d393c907c
commit
8d02850017
|
@ -180,7 +180,7 @@ class Category(models.Model):
|
||||||
super(Category, self).save()
|
super(Category, self).save()
|
||||||
|
|
||||||
def remove(self):
|
def remove(self):
|
||||||
blog = Blog.objects.get(pk=self.blog)
|
blog = Blog.objects.get(pk=self.blog.id)
|
||||||
output = blog.output_path + '/category/' + self.name_slug
|
output = blog.output_path + '/category/' + self.name_slug
|
||||||
if os.path.exists(output):
|
if os.path.exists(output):
|
||||||
shutil.rmtree(output)
|
shutil.rmtree(output)
|
||||||
|
@ -196,7 +196,7 @@ class Tag(models.Model):
|
||||||
super(Tag, self).save()
|
super(Tag, self).save()
|
||||||
|
|
||||||
def remove(self):
|
def remove(self):
|
||||||
blog = Blog.objects.get(pk=self.blog)
|
blog = Blog.objects.get(pk=self.blog.id)
|
||||||
output = blog.output_path + '/tag/' + self.name_slug
|
output = blog.output_path + '/tag/' + self.name_slug
|
||||||
if os.path.exists(output):
|
if os.path.exists(output):
|
||||||
shutil.rmtree(output)
|
shutil.rmtree(output)
|
||||||
|
|
2
views.py
2
views.py
|
@ -588,7 +588,7 @@ def _tinymcelist(request, b, year, month):
|
||||||
suffix = '/images/' + str(year) + '/' + str(month)
|
suffix = '/images/' + str(year) + '/' + str(month)
|
||||||
|
|
||||||
path = b.src_path + '/' + suffix
|
path = b.src_path + '/' + suffix
|
||||||
url = 'http://' + b.name + '/' + suffix + '/'
|
url = 'http://' + b.name + suffix + '/'
|
||||||
|
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
files = ''
|
files = ''
|
||||||
|
|
Loading…
Reference in New Issue
Block a user