Hello Nelson Varela ..... Thank you very Much for your reply. One more query - Should i check the permission ( by writing the extra code ) for extra Security. Definitely Your solution works well for me. I have implemented the same logic. But i want to know through the code
On Fri, May 17, 2019 at 7:32 PM Nelson Varela <nelson.c.var...@gmail.com> wrote: > Take a look at django permissions/groups models where you can make groups > and put these models in each group. After that you add the users to the > group so they can only edit models in that group > > On Monday, May 13, 2019 at 9:30:08 AM UTC+2, Balaji Shetty wrote: >> >> Hi >> Consider the demo Example >> >> models.py >> >> >> >> *from django.db import models >> >> class Musician(models.Model): >> first_name = models.CharField(max_length=50) >> last_name = models.CharField(max_length=50) >> instrument = models.CharField(max_length=100) >> >> class Album(models.Model): >> artist = models.ForeignKey(Musician, on_delete=models.CASCADE) >> name = models.CharField(max_length=100) >> release_date = models.DateField() >> num_stars = models.IntegerField()* >> >> *class Fan(models.Model): >> artist = models.ForeignKey(Musician, on_delete=models.CASCADE) >> Conutry = models.CharField(max_length=100) >> **Name = models.CharField(max_length=100) >> * >> >> Here We have to keep Track of Musician Album as well as all Fan/Follower >> of respective Musician. >> >> >> Admin.py >> >> >> >> *class AlbumInline(admin.TabularInline): >> model = Album* >> >> *class FanInline(admin.TabularInline): >> model = Fan* >> >> >> class MusicianAdmin(admin.ModelAdmin): >> >> inlines = [*AlbumInline,FanInline *, ] >> >> # code to register these 3 models >> --------------------------------------------- >> >> I have seperate Login User Account for Album >> I have seperate Login User Accpunt for Fan >> >> >> *My Question is* >> >> >> *I want to add only Album record in Album Login Account* >> >> >> >> *I want to add only Fan Record in Fan Login Account* >> >> >> *Currently * >> *In both login, Album and Fan Records can be added. How cam i restrict >> these?* >> >> -- >> >> >> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,* >> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India* >> *Official: bssh...@sggs.ac.in * >> * Mobile: +91-9270696267* >> >> -- > 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 django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > 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/e4a2ad0a-901c-4862-b313-9492783628cb%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/e4a2ad0a-901c-4862-b313-9492783628cb%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,* *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India* *Official: bsshe...@sggs.ac.in <bsshe...@sggs.ac.in> * * Mobile: +91-9270696267* -- 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 django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. 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/CAECSbOs3Zq%2Ba0qtK9H5kAspmCDAtjW5V85Bj-aVkixczZ_Ns7A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.