Re: Many to Many relationships in template

2020-02-27 Thread Gil Obradors
Hi!

https://docs.djangoproject.com/en/3.0/ref/contrib/admin/#modeladmin-objects
or
https://docs.djangoproject.com/en/3.0/intro/tutorial07/#writing-your-first-django-app-part-7

Missatge de Robb Rodirguez Jr.  del dia dv.,
28 de febr. 2020 a les 1:14:

> Good day guys, im new to django im having in many to many relationship
> display in template
>
> How can display this into a normal list..
>
> from .
> , , , ,
> ]>
>
> to.
> webadmin
> kim
> sem
> quinito
> user1
>
> Here's my code
>
> model.py
>
> class ListOfUser(models.Model):
> users = models.ManyToManyField(User, verbose_name='List of User')
>
>
>
> views.py
>
> def listofusers(request):
> userlist = ListOfUser.objects.get(id=1)
>
> form = ListofUserForms()
>
> context = {
> 'form': form,
> 'userlist': userlist
> }
> return render(request, 'listofusers.html', context)
>
>
> template
>
> {{userlist.users.all}}
>
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f3e604a7-5613-4f12-8aa6-526b19ae0fc7%40googlegroups.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK-JoTQQr%2BQODZoqWfJLNcdFsrkvLWXmUOqES0wcxSfCSHO59A%40mail.gmail.com.


Many to Many relationships in template

2020-02-27 Thread Robb Rodirguez Jr.
Good day guys, im new to django im having in many to many relationship 
display in template

How can display this into a normal list..

from . 
, , , , 
]>

to.
webadmin
kim
sem
quinito
user1

Here's my code

model.py 

class ListOfUser(models.Model):
users = models.ManyToManyField(User, verbose_name='List of User')



views.py

def listofusers(request):
userlist = ListOfUser.objects.get(id=1)

form = ListofUserForms()

context = {
'form': form,
'userlist': userlist
}
return render(request, 'listofusers.html', context)


template

{{userlist.users.all}}


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f3e604a7-5613-4f12-8aa6-526b19ae0fc7%40googlegroups.com.