Re: 3 models need to access 1 model
[EMAIL PROTECTED] wrote: > Thanks Steve. I currently don't have an admin.py file in any of my > apps. Is this as simple as creating the file and moving all > admin.site.register() and admin.ModelAdmin sections into it ? and the > file gets autoloaded ? > Pretty much, yes. regards Steve --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 3 models need to access 1 model
Thanks Steve. I currently don't have an admin.py file in any of my apps. Is this as simple as creating the file and moving all admin.site.register() and admin.ModelAdmin sections into it ? and the file gets autoloaded ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 3 models need to access 1 model
[EMAIL PROTECTED] wrote: > OK, I'm new to Django and this is probably making a silly mistake but, > to me the admin.site.register(Tag) line should appear at the bottom of > the Tags model. If this is done Django will not syncdb or runserver > because it thinks "Tag" has been registered more than once. However, > if you put the admin.site.register(Tag) line in any of the models that > are importing the Tags model it works fine - shows up in the admin > correctly, and the relationship works. > > Is this how it should work ? > No. Your app directory should contain an admin.py module. In that you import your models, create your admin.ModelAdmin subclasses and register your models (with the admin.ModelAdmin subclasses as required). regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 3 models need to access 1 model
OK, I'm new to Django and this is probably making a silly mistake but, to me the admin.site.register(Tag) line should appear at the bottom of the Tags model. If this is done Django will not syncdb or runserver because it thinks "Tag" has been registered more than once. However, if you put the admin.site.register(Tag) line in any of the models that are importing the Tags model it works fine - shows up in the admin correctly, and the relationship works. Is this how it should work ? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: 3 models need to access 1 model
Hrm I have this working now, got lucky with a google and found a django bug that had the info I needed to start. So am now using: appt4.models import Tag But am now actually experiencing the bug which is thought to be fixed. I'm using Django 1.0: http://code.djangoproject.com/ticket/6776 Whilst on the subject of the admin interface, should admin.autodiscover() make all models visible in the admin panel without needing to admin.site.register ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
3 models need to access 1 model
Hello, I have 3 apps. When records are saved to each app I want to associate tags to the records. In order for each app to access the same tags I think I would need a Tag app. Is it possible for models in different apps to access models in another ? So.. App1 class m1(models.Model): tag = models.ManyToMany(Tag) # app4 App2 class m2(models.Model): tag = models.ManyToMany(Tag) # app4 App3 class m3(models.Model): tag = models.ManyToMany(Tag) # app4 App4 class Tag(models.Model): name = models.CharField(max_length=50) Is it possible for models to access the models in other apps ? If this is possible, do you have any links to relevent docs or howto's on this topic. I have been searching but couldn't find the right term to search for. Thank you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---