Open OBKF opened 4 years ago
I'm not sure actually. I've never tried using ClusterableModel directly. From memory, wagtail Page models use ClusterableModel under the hood, but I've never had any problems with InstanceSelectorPanel on a Page's admin detail.
Maybe there's something missing in your admin wiring? How are you declaring the admin for the Hotel model?
Another possibility, there might be some kind of ClusterableModel model hook in wagtail that we'd need to opt into handling. If so, I'd expect there's an isinstance
check on the panel or a method/hook of some kind we'll need to add.
I don't have the time currently to dig into this myself, but I'm more than happy to help in any small ways. Providing context or explanations, etc.
@markfinger I switched to AutocompletePanel (wagtail-autocomplete) for this type of models, its not as convenient but it works.
How are you declaring the admin for the Hotel model?
My AdminView is simple and it is the same as the other models (not ClusterableModel and they work fine):
class HotelAdmin(ModelAdmin):
create_view_class = ServiceCreateView
model = Hotel
menu_label = "Hotels"
menu_icon = "fa-hotel"
menu_order = 100
add_to_settings_menu = False
list_display = ("name", "city", "available",)
search_fields = ("name",)
I don't have the time currently to dig into this myself, but I'm more than happy to help in any small ways. Providing context or explanations, etc.
For now I am Ok with using wagtail-autocomplete, but I will dig more into it when I finish this project or I really need it. Thanks
Hello, I am using InstanceSelectorPanel to provide a way to add ForeignKey values to a model with search (since the data may be huge later on), also I want to use Orderable to provide images to my model.
Now I have this error:
"<Hotel: Hotel object (None)>" needs to have a value for field "id" before this many-to-many relationship can be used.
code:
So is there any possible way I can go around this ?
Thanks.