class Customer(models.Model):
user = models.ForeignKey(User)
plan = models.ForeignKey(Plan)
def __str__(self):
return f"{self.user} - {self.plan}"
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5dae8b31-356c-45f3-b707-83b5ef33f396%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMsYeuFUNE3W8Cc2RGwn7L-LZ%2BhrNy9NPxiYVx_ZH7H4kUzR0Q%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/2ba44b9f-6526-4a6a-8311-632e83aeb4ba%40googlegroups.com.
One problem with any of the alternatives (besides making it readonly by default) is that it requires the other model to be registered in the admin
I hope there's _something_ we can do to somehow improve the situation. Maybe we could at least improve the examples in the documentation? Maybe give an example in the docs of a ModelAdmin subclass that defaults to using raw_id?
from django.contrib import admin
from django.contrib.admin import widgets
class RawFieldModelAdmin(admin.ModelAdmin):
def formfield_for_foreignkey(self, db_field, request, **kwargs):
db = kwargs.get('using')
if 'widget' not in kwargs:
if db_field.name not in (self.get_autocomplete_fields(request), self.radio_fields):
kwargs['widget'] = widgets.ForeignKeyRawIdWidget(db_field.remote_field, self.admin_site, using=db)
return super().formfield_for_foreignkey(db_field, request, **kwargs)
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/f888916c-78b9-4a06-aa83-c880a114d034%40googlegroups.com.
On 18 Jan 2019, at 17:20, Santiago Basulto <santiago...@gmail.com> wrote:Seems like everybody agrees that for large sites, it's necessary.
For *my* (completely unilateral) point of view, this is very important and I'd love to have a place to just flip a switch and change them all; well, I'd even prefer for it to be the default behavior, but I know selects look cool too.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/e18c8811-35ae-4607-b9bb-7bb826e8389c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On 19 Jan 2019, at 11:48, Santiago Basulto <santiago...@gmail.com> wrote:Haha, sorry, got overly excited. What's the usual process to make these sort of decisions in these cases? Should we ask the users list?
The setting proposal is purely from my perspective as a user. For *my* (completely unilateral) point of view, this is very important and I'd love to have a place to just flip a switch and change them all; well, I'd even prefer for it to be the default behavior, but I know selects look cool too.Now, from a "development" perspective, I do understand that it might be a big change.