Questions tagged as 'python'

1
answer

Python: Iterate in a for and get as many objects in the list

I have a list of apple and pear products and I want to print on the screen how many apples there are by if but only print the "no apples". Where is the error and how can I fix it? This is my code: p = ["manzana_00", "manzana_01", "ma...
asked by 28.07.2016 / 01:14
2
answers

Get values from a form

I'm trying to get the values out of a form that is not in the forms.py, besides this has a button to add a value, what I want is only to print the values entered on the screen, unfortunately I could not make it work. Error message    local...
asked by 07.10.2016 / 23:21
1
answer

I want to validate with ajax and json in Django, a field if it already exists before submitting?

This is the url: url(r'validar/celda', SGregorio_views.validarcelda, name='validarcelda'), This is the view to validate: def validarcelda(request): error = '' success = False if request.method == 'POST': celda = reques...
asked by 04.10.2016 / 17:54
2
answers

Nest objects related tables Django API REST Framework

I have 3 related tables, 1 - > 2 - > 3 Now with mysql we would do inner join of the tables and now we could filter by fields of the 3, the thing is that with the REST API I would like to nest all the elements of the 3 related to the 2 rel...
asked by 26.05.2016 / 13:06
1
answer

How to execute conditions when pressing button

How about, I am new to programming in tkinter and I am creating a graphical interface to generate text with interruptions of a button, my intention is that the code show the alphabet and that the cursor is interrupted in the desired row and star...
asked by 13.09.2016 / 02:25
1
answer

How to recharge modal windows in Django?

What I want to do is that if the message is activated, the JS takes it and then reopens the modal with the form and the error, that's just it. But I do not know how to do it. This is the view: def inventarioingresoe(request): #Codigo...
asked by 28.09.2016 / 20:39
1
answer

I want to know how to pass a django for in javascript?

This is my code: {%for obj in empaque %} celdae = {{"obj.celda"}} {%enfor%} if (document.empaque.celda.value == celdae) { alert("La celda ya esta ocupada") document.empaque.celda.focus() return false;}...
asked by 29.09.2016 / 18:40
2
answers

Use filter in Django

I have my function buscar , but I get this error: Here is the code: view.py class ListarTipoAlmacen(ListView): model = Tipo_almacen template_name = 'tipo_almacen/lista_tipo_almacen.html' paginate_by = 10 def...
asked by 23.03.2016 / 20:49
2
answers

How to install Django in a virtual environment?

I'm having problems with a Django installation that I did in a virtual environment and basically I have only one question: Is it necessary to install Django within each new virtual environment that I create? that is, if I create a new Django...
asked by 12.11.2016 / 19:50
1
answer

Error trying to calculate element with the highest value of an array

I have a problem with the following function: def conjunmas(): for (conjunto) in (arreglo): totalm = 0 cma = 0 for (unidad) in (arreglo): totalm = (totalm + unidad) if (totalm > cm...
asked by 10.05.2016 / 02:49