On 20/05/2018 1:45 PM, Daniel Germano Travieso wrote:
There is no really definitive approach to handle this, and you could
do it either way.
Either option works, but for a philosofical point of view, if there is
no significant difference between the user types, the first approach I
tend to beli
Page not found (404)
Request Method: GET
Request URL:http//127.0.0.1:800/
Using the URLconf defined in mysite.urls, Django tries these URL patterns,
in this order:
1. admin/
2. personal/
The empty path didn't match any of these. This is the mge I hv been getting
when ever I run my surver on pers
Hello,
I have a two models (User, Project) in m2m relationship with intermediate
(Role) table.
When I’m selecting all users in project and I also want to select corresponding
role, I simply annotate one field from Role table using F expression:
Users.objects.all().filter(projects__name=‘Django’
Thanks very much. I have solved the problem.
On Sunday, May 20, 2018, Daniel Germano Travieso
wrote:
> Hello!
>
> On your case, as stated on the official doc, you should just create a
> method on the model you want to display the ManyToMany field on the
> list_display that maybe returns the list
I completely forgot about `extra` method and it seems it does solve the problem:
roles = Prefetch(
‘users',
queryset=User.objects.extra(select={'role': 'users_role.role'})
)
qs = Project.objects.prefetch_related(roles))
However, I’m still curious why `annotate` doesn’t work when used insi
Hi, I'm trying to set up Templates for Django. I already have models and
views that function, and now I'm trying to figure out a way to get an
actual page to show for it.
My models are
from django.db import models
class Continent(models.Model):
name = models.CharField(max_length=60, de
Hi, Francis. Did you try mozilla developer network ? I consider this for my
further learning.
вторник, 15 мая 2018 г., 23:01:59 UTC+3 пользователь Francis F. Massaquoi,
Jr. написал:
>
> Hi, I'm Francis F. Massaquoi, Jr. with great interest in learning django
> 2.0, which is the latest version,
On Fri, May 18, 2018 at 10:28:00PM -0700, sahadev sahu wrote:
> Hello,
>
> I am implementing a websocket application for live data feed updates to
> each client according to their watchlist in every 5 second. Here I am
> explaining my requirement:
>
>1. Once user register with my applicatio
Create a view that returns json. At least if you want to use it in an ajax
way. Otherwise, I would recommend just passing it as an argument to the
templates that use it.
import json
def years(request):
return HttpResponse(json.dumps(dict(Model.YEAR_IN_SCHOOL_CHOICES)),
content_type=‘appl
9 matches
Mail list logo