Skip to content

Commit

Permalink
Added workaround for deleting pages with HtmlPageTranslation on it.
Browse files Browse the repository at this point in the history
This is a workaround to handle #47
  • Loading branch information
vdboor committed Jan 14, 2015
1 parent 030e08e commit 959211c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Changes in version 0.9 (dev)
* Change ``slug`` size to 100 characters.
* Added ``FluentContentsPage.create_placeholder(slot)`` API.
* Added ``--mptt-only`` option to ``manage.py rebuild_page_tree`` command.
* Fix deleting pages with ``HtmlPageTranslation``.


Released in 0.9b4:
Expand Down
11 changes: 11 additions & 0 deletions fluent_pages/models/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,17 @@ def meta_robots(self):
else:
return None

def delete(self, *args, **kwargs):
# Fix deleting pages, Django's collector doesn't detect the HtmlPageTranslation model
# because the FK points to a proxy. This is a workaround for:
# https://code.djangoproject.com/ticket/16128
# https://code.djangoproject.com/ticket/18491
# By using .all() we avoid the get_query_set/get_queryset() difference.
self.seo_translations.all().delete() # Accesses RelatedManager

# Continue regular delete.
super(HtmlPage, self).delete(*args, **kwargs)




Expand Down

0 comments on commit 959211c

Please sign in to comment.