#33555: Enable Model Field choices to hold other Model objects as values of the iterable. -------------------------------------+------------------------------------- Reporter: | Owner: nobody myk4040okothogodo | Type: New | Status: new feature | Component: Database | Version: 4.0 layer (models, ORM) | Keywords: choices option for Severity: Normal | model objects Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- Allow for something like: from django.db import models from django.utils.translation import ugettext_lazy as _ from Documents.models import Document from Comments.models import Comment
class Notification(models.Model): ENTITY = ( (Document , _('Notification on Document')), (Comment , _('Notification on Comment')), ) notificationBelongsTo = models.OneToOneField(choices=ENTITY,default= Document, on_delete=Models.CASCADE) This would allow for an option to choose the relation from a list of objects(that are in this case related models) -- Ticket URL: <https://code.djangoproject.com/ticket/33555> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107017f59d0d47a-831f9bb6-d299-4720-9995-51b791185e52-000000%40eu-central-1.amazonses.com.