Questions tagged as 'django'

1
answer

How to generate a json of an object that comes from forms.ModelForm

Hi, I would like to create and save an object in the database which has arguments args and kwargs . the arguments args and kwargs must obey the format JSON , I have the following: class ProgramarActividadForm(f...
asked by 20.01.2016 / 13:28
0
answers

Problems loading CSS styles in Django project

I have started to maintain a site already built and I have been asked to add a carousel. I have integrated a model: class Event(models.Model): tag = models.CharField(max_length=100, verbose_name="Tag") title = models.CharField(max_len...
asked by 26.11.2018 / 02:44
1
answer

SQL query to DJset's queryset

I have the following SQL query: SELECT DISTINCT ON (e.id) e.id, e.nombre, e.apellido, e.estado, e.documento, c.nivelado, s.nombre AS semestre, t.nombre AS tipo FROM estudiante e JOIN caracterizacion c ON c.estudia...
asked by 21.11.2018 / 06:04
0
answers

Django required () got an unexpected keyword argument 'username'

Urls.py: from django.urls import path from .views import login, logout, signup, edit_profile, profile_view app_name = 'accounts' urlpatterns = [ path('login/', login, name='login'), path('logout/', logout, name='logout'), path('s...
asked by 29.09.2018 / 13:47
3
answers

How to capture parameters sent by the GET method?

This is the way I use but I do not get to capture the parameter in the controller enters the else but does not capture: def get(self, request, *args, **kwargs): if request.method=='POST': print "rrr" * 99 else:...
asked by 18.05.2016 / 23:04
0
answers

Django does not direct to the correct URL

views.py class PartnerListView(ListView): model = Partner template_name = 'contacts/partner_list.html' def get_context_data(self, *args, **kwargs): context = super(PartnerListView, self).get_context_data(**kwargs)...
asked by 07.07.2018 / 15:09
0
answers

Django: Add two DurationField fields

I am creating a project in Django, my model has two fields where I add up the hours of a given activity, in my view I make a query where I sum the total hours of activities per student but I want to add duracion_dft with duracion_dfp, ¿ How can...
asked by 23.06.2018 / 01:44
1
answer

Sort Relationships (ManyToMany) without duplicating records

For days I have been trying to sort a series of queries by passing as parameter objects.order_by ("relation"). distinct () of type "ManyToMany" but always duplicates the query "x" the number of relations, being the Last the desired one. class...
asked by 29.04.2018 / 02:54
2
answers

Sum of dictionaries

I'm working with python and django and I have several data dictionaries that I want to add up for a total. All dictionaries can have two keys primera and segunda , but I must get a total of both primera and segunda...
asked by 05.01.2018 / 00:06
1
answer

Selects nested with Django and AJAX

I am doing tests for a form that I must do and the most important thing are two combo boxes, where the second one depends on the choice of the first one. I have done many tests with different methods but I have not achieved the result I need....
asked by 26.09.2017 / 16:29