Questions tagged as 'django'

1
answer

multiple statistics on django

I have to calculate a series of data for my project, it works 100% when it comes to general calculation, but when I try to take those same calculations to the facilities ( jovenclubs ) separately it returns me a list with all the values it...
asked by 21.04.2017 / 19:23
2
answers

How can I create a field in a form without having to create it in a model?

I have a ModelForm in which I want to add a field without having to create it in the model, how can I do it? If you are wondering why I want to have a field in a form if I am not going to send it to the model, it is because I am going to take...
asked by 25.08.2017 / 02:57
1
answer

Cycle an arrangement of a MongoDB object in Python with Django

I'm trying to cycle an array that comes from a node in mongoDB, this is Mongo's object: { "nombre": "Sebastián Yatra", "paises":["México","Argentina","Perú"] } The view controller is this from django.shortcuts import render from pymon...
asked by 03.08.2018 / 22:02
1
answer

NoReverseMatch and Post Token in the URL in Class Based Views

I'm trying to do a simple "edit and delete" with views based on Django classes. The problem is that I'm getting these errors with UpdateView and DeleteView . One occurs when I want to redirect to its DetailView after the...
asked by 30.08.2017 / 22:53
1
answer

Django CORS 'Access-Control-Allow-Origin'

I'm trying to redirect a Django View function to a page in PHP, currently hosted on my own computer. The fact is that I've seen that it gives me a crossover error because I'm calling another link from my own team. I have found a module cal...
asked by 29.01.2018 / 10:05
1
answer

Show only the first image in template in Django

I have two models: the first Property model and the second model Property Image: Class Property(models.model): title = models.CharField() Class PropertyImage(models.model): property = modelos.Foreignkey(Property, related_name='images...
asked by 17.10.2016 / 00:26
2
answers

Two forms in a single view Django - CreateView

I am trying to create a single form for a user that has fields of both forms, both the user and the userprofile that you create to extend the model. models.py from django.db import models from django.forms import ModelF...
asked by 02.09.2016 / 16:30
1
answer

Concatenate time Django

I have a project in django where I have the fields hour, minutes, seconds separately I need to concatenate them so that they remain in the format "% H:% M:% S" direferencia=6243.0 #Este valor esta en segundos hora=math.floor(diferencia/36...
asked by 13.08.2016 / 04:55
1
answer

add hours in Django models

I am trying to make a movie model in Django, but I would like to add the duration of it and I do not know how to do it very well in django, I know that you can add date and time with datetime in the models. But I only want an hour of dura...
asked by 15.08.2016 / 15:17
1
answer

Filter by fields of the same model

I need to know how I can filter in a model that is an Invoice where I have two fields to pay and another that is paid, I have to do a filter to get the bills that have different amounts than paid to know which of the bills are unpaid. class Fa...
asked by 29.08.2018 / 15:16