Posts by André Duarte • 351 points
7 posts
-
1
votes2
answers58
viewsA: Random search doesn’t work
Tendencias is returning all objects or bank lines do so from random import randint ... tendencias = Frase.objects.all().order_by('?').first() #ou entao assim para pegar um registro realmente…
-
4
votes2
answers2510
viewsA: Django - select options
#arquivo forms.py from django import forms class MeuForm(forms.Form): #no choices eu fiz um list comprehension que apenas gera um list [a,b,c...z] que vai ser renderizado no select coordenadores =…
-
4
votes1
answer276
viewsA: Total with plurality in Django template
According to the documentation the pluralize accepts the argument in singular and plural. <h4> {{ combination|length }} combina{{ combination|length|pluralize:"ção,ções" }} </h4> he will…
-
1
votes1
answer165
viewsA: Sort Datetimefield by date only
Try using the . extra resultado = Person.objects.extra(select = {'date_only': 'to_date(date_joined)'}).order_by('-date_only', 'fullname')
-
3
votes1
answer806
viewsA: How to implement "Foreign key" using Micro Services architecture? Django
Do not take this question of uncoupling too literally because it risks doing so in the wrong place. Try to bring the idea of micro service to the real world and see what happens. Imagine the…
-
5
votes2
answers29234
viewsA: Create . txt file in PYTHON if it does not exist
If you do that, you don’t have to call twice. arquivo = open(input('Nome do arquivo a ser editado:'), 'r+') texto = arquivo.readlines() texto.append(input('insira o valor'))…
-
1
votes1
answer535
viewsA: Track gps coordinates of one device and show in another
Well, this is a matter of application architecture as a whole, so let’s imagine that we have two devices A and B. Check the position of an appliance A is available through Cordova / phonegap…