These are chat archives for django/django

28th
Jun 2016
Andrew Backer
@awbacker
Jun 28 2016 03:44
I think the accepted answer to the question addresses that pretty clearly
Its a non-sensical line, it seems. the variable 'user' is misnamed, it's getting the Voter.id field, and somtimes that matches a valid user. The expression should probably be [voter.user_id for voter in Voter.objects.filter...]. That is inefficient, and the answer also addresses that issue.
or voter.user.id, if you want to be really inefficient
Also, Voter is a bad name. Vote would be better, since it links a user and a poll, and is really a vote cast, not a "voter", which would be the person
harshit-j
@harshit-j
Jun 28 2016 14:38
@awbacker Thanks for clarification. I missed that 'user' actually is a Voter object here.
QbasicFan
@QbasicFan
Jun 28 2016 16:19

hello I am trying to display some content of a list not all the elements unlike :

{% for i in all_list %}
{{ i.value }}<br>
{% endfor %}

Rather , I would like to show one element at a time preceded by "prev" and succeed by "next" navigation buttons ... so I can navigate my list
The pseudo code could look like this (for next button ) :

if (list.next.id){
list.current.id = list.next.id 
}else{
//loopback
list.current.id = list.first.id
}
Patrick Harding
@senorpatricio
Jun 28 2016 16:20
pagination?
QbasicFan
@QbasicFan
Jun 28 2016 16:20
what you mean by that ?
Metehan Çelenk
@themlistone
Jun 28 2016 16:23
@QbasicFan He means that you want to split your data into pages?
Patrick Harding
@senorpatricio
Jun 28 2016 16:24
yes. you can split your data into pages
QbasicFan
@QbasicFan
Jun 28 2016 16:24
@senorpatricio :+1:
Jared Mackey
@mackeyja92
Jun 28 2016 16:25
@senorpatricio So quick on those docs ;)
Patrick Harding
@senorpatricio
Jun 28 2016 16:25
@mackeyja92 they’re my :bread: and butter
Metehan Çelenk
@themlistone
Jun 28 2016 16:26
@senorpatricio loved that :heart:
Patrick Harding
@senorpatricio
Jun 28 2016 16:26
plus, django’s docs are so good.
Jared Mackey
@mackeyja92
Jun 28 2016 16:30
@senorpatricio I seem to find myself looking at this page at least twice a week https://docs.djangoproject.com/en/1.9/topics/db/aggregation/
Patrick Harding
@senorpatricio
Jun 28 2016 16:32
hmmmm. i haven’t gotten into aggregation too much but it looks like it does a lot
Jared Mackey
@mackeyja92
Jun 28 2016 16:33
Yes, there are some amazing features in the ORM. Typically the DB is much faster at aggregating your data than looping through it in python so using as many builtin functions as possible is the way to go.
Metehan Çelenk
@themlistone
Jun 28 2016 16:33
@senorpatricio So there's a question I'd like to ask, what do you guys say about django's scalability on cloud?
Jared Mackey
@mackeyja92
Jun 28 2016 16:34
@themlistone It’s alright. It depends on what you are using it for and the web server you a using. We use Apache and it has been pretty good.
I wouldn’t recommend apache though, use like uwsgi or gunicorn.
Patrick Harding
@senorpatricio
Jun 28 2016 16:35
yeah from what i understand on Apache it’s pretty scalable
Metehan Çelenk
@themlistone
Jun 28 2016 16:36
I was thinking about to move my scikit based machine learning demo to django on Azure cloud. But after a week I realized something was not right about the usages. Now I'm sure It was because of me.
Jared Mackey
@mackeyja92
Jun 28 2016 16:37
@themlistone are you on Windows?
Metehan Çelenk
@themlistone
Jun 28 2016 16:37
Unfortunately, yes.
Jared Mackey
@mackeyja92
Jun 28 2016 16:37
ouch. Good luck with that :)
Metehan Çelenk
@themlistone
Jun 28 2016 16:37
No please it hurts
Jared Mackey
@mackeyja92
Jun 28 2016 16:38
Do you have to use Azure? Can you have your app hosted in another environment?
I mean, locally developing it on Windows is one thing, but deploying on it is another.
Metehan Çelenk
@themlistone
Jun 28 2016 16:41
Oh I got what you meant now. Actually deployment has to be on Windows. And I have developed the whole project on Arch Linux. But now I'm a little bit exhausted about it. Switcing envs
Even I got a checklist for both envs. :smile: That's a hard thing for me.
And for the other question; Since I fell in love with .NET, I never tried anoter environments.
For a little time I've wrked wih Google Cloud to train my speech recognition models with Google's one.
Metehan Çelenk
@themlistone
Jun 28 2016 16:47
So whole story is written here because I'm thinking to get a new mac and continue my development on it. Also thinking about to move my asp.net core api apps to django rest
But like I said before I'm worried about it.