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: [email protected] <[email protected]> *
*  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 [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/CAECSbOsTUKoR0RbG%3DYZ18CGVwno1nJE%2BSXkyBWeiS6%3Dd%3DYm9pQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to