I'm facing a problem while trying to reference a model from a different app 
inside admin.py


Let's say for example that inside App1 we have a model called Sensor

#app1 > models.py 
>
> class Sensor(models.Model):
>    ...
>


And inside App2 we've referenced Sensor as a FK using 'app1.Sensor'

#app2 > models.py
>
> class Measurement(models.Model):
>     device = models.ForeignKey('app1.Sensor')
>     ....
>


Now if we try to reference that model in App2 > admin.py.
We're getting:   *...app1.Sensor has not ForeignKey to app2.Measurement...*

#app2 > admin.py
>
> from app1 import models as app1_models
>  
>
class SensorInline(admin.TabularInline):
>     model = app1_models.Sensor
>


How to add as an Inline a FK from another app?


Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c1d1be08-34d8-4c94-a11f-5e8c8552ff8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to