Skip to content
Browse files

added fix for situations when current site is not created (for instan…

…ce first syncdb when project is installed)
  • Loading branch information...
1 parent 3a3004f commit 73469c5984970267e96923c11344588564876986 @barszczmm committed Mar 13, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 treenav/models.py
View
10 treenav/models.py
@@ -90,7 +90,15 @@ def update(self, *args, **kwargs):
class MenuItemManager(models.Manager):
def get_query_set(self):
- return MenuUnCacheQuerySet(self.model).filter(site=Site.objects.get_current())
+ try:
+ current_site = Site.objects.get_current()
+ except:
+ current_site = None
+ queryset = MenuUnCacheQuerySet(self.model)
+ if current_site:
+ return queryset.filter(site=current_site)
+ else:
+ return queryset
class MenuItem(models.Model):

0 comments on commit 73469c5

Please sign in to comment.
Something went wrong with that request. Please try again.