Questions tagged as 'django'

1
answer

Error NoReverseMatch on django

I am receiving the following error on my page made with django.    Reverse for 'subscribed' with keyword arguments' {'name': u'ImHarvol '}' not found. 1 pattern (s) tried: ['edoras / newsletter / subscribed $'] The page consists of a form...
asked by 15.08.2017 / 15:52
2
answers

Get parameters in a CreateView view

I have a CreateView view to which I am sending a parameter by url, my question is how can I take that parameter to save it in one of the fields of the model? View: class ReferenciarSimpatizanteCreateView(CreateView): model = Referencia...
asked by 11.07.2017 / 19:53
1
answer

@login_required in view-based classes

You see, I have the following view: class contenido_adicional(View): def get(self,request): form=bonus() return render(request,'privilegio.html',{'forma':form}) def post(self,request): form=bonus(request.POST)...
asked by 29.05.2017 / 18:57
2
answers

Filter ages django

Good afternoon friends, I am creating an app in Django 1.10 and I have a model where the basic data of the people will be stored, this model includes a dateNaciento field, in this model create a method which calculates the age of the people ....
asked by 14.05.2017 / 00:40
1
answer

consultations on django models

I have a problem that I do not know how to solve it. I have three models in my app: class Hecho(models.Model): codigo = models.CharField(max_length=1) hecho = models.CharField(max_length=100) class Beneficiario(models.Model): tipo...
asked by 14.03.2017 / 03:19
2
answers

Django: Error matching query does not exist

This code throws me the error:    matching query does not exist Apparently the filter I have designed does not capture the id of the Orders. Code: models.py: class Pedido(models.Model): especialidad = models.ForeignKey('Especi...
asked by 05.03.2017 / 23:43
1
answer

Render multiple forms and validate them in a single template in DJANGO

I tried to render 3 forms with Class-based views in a single template but I did not succeed, so I decided to do something like this with a method: def formTortas(request): .... where I call my 3 forms defended in Forms.py in this way,...
asked by 06.04.2017 / 19:59
2
answers

How to solve this query set? [duplicate]

I have a problem where I want to subtract two fields and then update a record, which would be cantidad - stock , and the latter would be the modified one, here the model: models.py: class Pedido(models.Model): especialidad = m...
asked by 13.02.2017 / 15:15
2
answers

Consult several Django models

I have these models: class TablaA(models.Model): estado = models.BooleanField() # mas campos... class TablaB(models.Model): tabla_a = models.ForeignKey(TablaA) estado = models.BooleanField() # mas campos... class TablaC(m...
asked by 17.01.2017 / 01:14
1
answer

Django paginator in AJAX

I am trying to return the elements of the table professionals and the next page, both data in a JSON. The problem arises when I see the JSON that is returned: my professionals model is a string, not an array of objects. Here I leave my co...
asked by 19.12.2016 / 15:01