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. Professor
Department of Information Technology,
SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India