Re: How to do a generic field in an app.

2016-09-20 Thread Jonty Needham
So now, I'd like to do the following: class AppConfig(models.Model): my_content_type = ForeighnKey(ContentType) wrote: > Awesome -- thanks! > > On Mon, Sep 19, 2016 at 6:48 PM, Tim Graham wrote: > >> Do you know about https://docs.djangoproject.com >> /en/stable/ref/contrib/contenttypes

Re: How to do a generic field in an app.

2016-09-20 Thread Jonty Needham
Awesome -- thanks! On Mon, Sep 19, 2016 at 6:48 PM, Tim Graham wrote: > Do you know about https://docs.djangoproject.com/en/stable/ref/contrib/ > contenttypes/#generic-relations ? > > > On Monday, September 19, 2016 at 12:30:01 PM UTC-4, Jonty Needham wrote: >> >> I want to have a model that has

Re: How to do a generic field in an app.

2016-09-19 Thread Tim Graham
Do you know about https://docs.djangoproject.com/en/stable/ref/contrib/contenttypes/#generic-relations ? On Monday, September 19, 2016 at 12:30:01 PM UTC-4, Jonty Needham wrote: > > I want to have a model that has a foreignkey to a model from another app. > The app can be one of many. > > So f

How to do a generic field in an app.

2016-09-19 Thread Jonty Needham
I want to have a model that has a foreignkey to a model from another app. The app can be one of many. So far I've come up with a two field solution with: model_type = ForeignKey(ContentType) pk_field = PositiveIntegerField() with an appropriate getter. Is there a better way to do this? It feels