Added db_index to Contentlet/ContentReference names, AttributeValue fields, and Navig...
[philo.git] / contrib / shipherd / models.py
index bddaef3..8efc57a 100644 (file)
@@ -155,8 +155,7 @@ class NavigationManager(models.Manager):
                
                # A distinct query is not strictly necessary. TODO: benchmark the efficiency
                # with/without distinct.
-               #change to navigation_navigation_items
-               targets = list(Node.objects.filter(navigation_items__in=items).distinct())
+               targets = list(Node.objects.filter(shipherd_navigationitem_related__in=items).distinct())
                
                for cache in caches:
                        for item in cache['items']:
@@ -170,7 +169,7 @@ class Navigation(Entity):
        objects = NavigationManager()
        
        node = models.ForeignKey(Node, related_name='navigation_set', help_text="Be available as navigation for this node.")
-       key = models.CharField(max_length=255, validators=[RegexValidator("\w+")], help_text="Must contain one or more alphanumeric characters or underscores.")
+       key = models.CharField(max_length=255, validators=[RegexValidator("\w+")], help_text="Must contain one or more alphanumeric characters or underscores.", db_index=True)
        depth = models.PositiveSmallIntegerField(default=DEFAULT_NAVIGATION_DEPTH, validators=[MinValueValidator(1)], help_text="Defines the maximum display depth of this navigation.")
        
        def __init__(self, *args, **kwargs):