Here was my version - I liked the result of defining the choice list in the field definition, it's a more obvious dropdown box and also doesn't populate the field until you select rather than going to the first option without any user input:
@register_snippet
class ParentSnippet(TranslatableMixin, ClusterableModel):
code = models.CharField(blank=False, null=True, max_length=10)
title = models.CharField(blank=False, null=True, max_length=50)
class ChoiceListIterator(object):
def __iter__(self):
dropdown_list = list(ChoiceListClass.objects.values_list('code','title'))
return dropdown_list.__iter__()
class ChildOrderable:
p_key= ParentalKey(
"ParentSnippet",
related_name="child_items",
)
choice_list=ChoiceListIterator()
submenu_selector=Select()
submenu_selector.choices = choice_list
dropdown_test = models.CharField(
blank=False,
null=True,
max_length=10,
choices=choice_list
)
panels = [
FieldPanel("dropdown_test"),
]
This leaves the last challenge - access the instance of the parent snippet so that I can dynamically filter the list based on properties in that instance. ParentalKey is None until the oderable is saved - anyone know how to access the parent instance before that point?