[Answer]-How to view a particluar list of contacts or only my contacts in Django application?

1👍

You should add another Field in Your ContactForm Model that is for which the current contact belongs to (the user which has logged in)

from django.contrib.auth.models import User

class ContactForm(forms.Form):
    contact_belongs_to = models.ForeignKey(User, on_delete=models.CASCADE)
    name = forms.CharField()
    dob = forms.DateField()
    email = forms.EmailField()
    mobile = forms.IntegerField()

and then filter it by User.id

0👍

Sounds like you need to filter your query results – see the django docs on making queries

Your models probably have a many-to-many relationship too, so i recommend you read the django docs on many-to-many relationships

Note – it would be easier to help you if you posted some code (particularly the model and view)

Leave a comment