Thank you for your response.

Regards,
Soumen

On Sun, 28 Jul 2019, 23:27 Juhana Jauhiainen, <[email protected]>
wrote:

> Hi Soumen,
>
> You could try with
>
> profiles = Profile.objects.filter(user__username=username)
>
>
> I would also suggest changing your model definition to something like
>
> class Profile(models.Model):
>     user = models.OneToOneField(User, on_delete=models.CASCADE)
>
> Then you will have exactly one Profile per User and you can also access
> the Profile from user object with
>
> user.profile
>
> FYI, related_name defines the name of reverse relation. So in your case it
> would mean you can access the profile from a user object with
>
> user.user_model
>
> Which is probably not what you want..
>
> -Juhana
>
> On Sun, Jul 28, 2019 at 7:49 PM Soumen Khatua <[email protected]>
> wrote:
>
>> Hi Folks,
>> I Extended Profile Model from dajngo inbuilt User model but Now I want
>> call all the details those are associated with Username in Profile model. I
>> got the username but how i cann call it in Profile model.
>>
>> Ex:
>> class Profile(models.Model):
>> user = models.ForeignKey(User,related_name = 'user_model,..........)
>>
>> data = Profile.objects.filter(user = username)
>>
>> But it's not working please help me guys.
>>
>> Thank You
>>
>> Regards,
>> Soumen
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPUw6WY%2BUNTU6UOAKyOxMWg24dAsmc7eB7%3D9kZTDjiukn3%2BKJQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPUw6WY%2BUNTU6UOAKyOxMWg24dAsmc7eB7%3D9kZTDjiukn3%2BKJQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABScFx851WQseNsCYf%3DYdW6eAYiPW05EQg-qEk%2B%2BTSZNVAXGuQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABScFx851WQseNsCYf%3DYdW6eAYiPW05EQg-qEk%2B%2BTSZNVAXGuQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WY%3DX6_moHtc%2BdJYqE2R3TnKVuc-SNPfXHx_d9oGqVCd-g%40mail.gmail.com.

Reply via email to