Questions tagged as 'django'

0
answers

How to translate a queryset to subquery in django?

This is my problem I want to group by a field which is a result of an annotate, but I can not do it. from django.db.models import Max, Sum queryset = queryset.values('period', 'cell').annotate(x=Max('total')) result = queryset.values('period')...
asked by 19.07.2018 / 21:24
0
answers

convert mysql query to django

Guys! I have this query that I want to use in Django and I can not find a way to do it. I hope you can help me: SELECT herramienta_id, SUM(cantidad) FROM inventario_transaccion WHERE carrito_id=1 GROUP BY herramienta_id What I want to do...
asked by 25.07.2018 / 01:18
1
answer

Handle a ModelMultipleChoiceField from the views.py

I have this field in my form And I want the views.py to collect all the coins chosen, currently only returns the last one. views.py class userPageView(TemplateView): template_name = 'user.html' def get_context_data(self, **kwargs):...
asked by 07.07.2018 / 13:09
3
answers

How to declare a ChoiceField on models.py

Good I am modifying my project and decided to place a ChoiceField but when I want to make the makemigrate I get the following error:    File "/home/jbarreto/Documentos/Misproyectos/Personal/personal/datos/models.py", line 8, in Employe...
asked by 16.08.2018 / 15:19
1
answer

Show form in a view based on Django classes

I have the impression that it must be something simple, but I can not do it with CBV's. I try to render a view that shows the content of a post, and at the same time, in the same view, show a form so that comments can be added to it. The first t...
asked by 06.07.2018 / 01:27
0
answers

Modify admin form of Django

Is there any way to modify the structure of a Model's fields in the Django administrator? So that the fields (F000, F001, F010, FO11, F012) are displayed Horizontally     
asked by 26.05.2018 / 19:22
1
answer

UpdateView creates new items in a Formset, does not update them

Two months ago I started using Django. Right now I have the CBV of a form with two elements, a Parent Model and a Child Model that can be multiple. I have functional part of Create, Detail, List and Delete. I have the problem when editing with t...
asked by 16.05.2018 / 10:33
0
answers

Show one field depending on the value of another. Django Forms

Very good to everyone. I have a problem when displaying elements in a form in Django. I have 2 models, one called Recurso and another called Sesion , which are related in such a way that a resource can have several sessions availabl...
asked by 18.06.2018 / 13:15
1
answer

Redirect to another page using AJAX

An AJAX function, which passed a list containing the id of the selected rows of a table and two values of type date that are the start date and the end date. Those values are the process in a view that I have developed with Djan...
asked by 20.08.2018 / 20:48
0
answers

Receive request from urls.py

In the user activation system of my platform, the user accesses a link in the following way: http://127.0.0.1:8000/activate/XSWEKklut8tzDdH/[email protected]/ My file urls.py #home/urls.py from django.urls import path, re_path from home...
asked by 29.06.2018 / 20:52