You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It'd be neat to have SingletonModel instances that are unique per site. I think the only thing that is needed is adding a FK to the Site model, and changing the uniqueness check to be per-site. Is this something you would consider?
The text was updated successfully, but these errors were encountered:
That could be a good idea - thanks for the suggestion. I think there should not be a dependency, by default, to the site framework. If you propose a pull request, it can be collectively reviewed. May be you can describe here your implementation before starting coding.
Thanks.
My idea was to introduce a new model: SiteSingletonModel (it would only need to subclass SingletonModel and add a FK to Site. Users can then choose which one they want to inherit from. Not sure if we should create new managers, templatetags, etc, or just do some type checking in the existing ones.
9 years after, but to anyone who may find this, you can do this with by adding the current site id to the model extending SingletonModel like so:
from solo.models import SingletonModel
from django.contrib.sites.models import Site
current_site = Site.objects.get_current()
class SomeModel(SingletonModel):
...
singleton_instance_id = current_site.id
It'd be neat to have
SingletonModel
instances that are unique per site. I think the only thing that is needed is adding a FK to theSite
model, and changing the uniqueness check to be per-site. Is this something you would consider?The text was updated successfully, but these errors were encountered: