Monday, October 24, 2022

how to show liste filtre admin django ManyToOne

how to show liste filtre admin django ManyToOne in this case :

in models.py -----------

class Personne(models.Model):

name= models.CharField(max_length=50,blank=False) def __str__(self): return self.name

class Project(models.Model):

title= models.CharField(max_length=50,blank=False) note= models.CharField(max_length=50,blank=False) def __str__(self): return self.title

class Task(models.Model):

title= models.CharField(max_length=50,blank=False) projecttasktask= models.ForeignKey(Project, on_delete=models.CASCADE) personnetask= models.ForeignKey(Personne, on_delete=models.CASCADE) def __str__(self): return self.title

in admin.py ---------------

ProjectAdmin(admin.ModelAdmin):

list_filter = ()

How can i filtre in Project by tasks and specialy by Personne

liste dropdown of personne and show me liste of projects ?

best ragards

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b5782617-a2c9-480a-90e7-8204b7143b7bn%40googlegroups.com.

No comments:

Post a Comment