Questions tagged as 'django'

1
answer

Concatenate integer and string in a Djangoplate theme

Good morning, The problem I have is that I want to concatenate an int with a string in a Django template, but when I try it, I return an empty value. This is my code: {% with "object_"|add:obj.id as check_id %} El objeto es {{check_id}} {%...
asked by 06.03.2017 / 23:21
1
answer

multiple kwargs in django's template

I have a regular expression defined to capture optional parameters in a view. url(r'^lista/((?P<tematica>[0-9]+)/(?P<pageIndex>[0-9]+)/(?P<pageSize>[0-9]+))|/$', views.PinturasListView.as_view(), name='lista') in theory,...
asked by 23.02.2017 / 02:41
1
answer

No Django settings specified [closed]

Good afternoon, I'm trying to create my project in Django but when I run the command "django-admin createproyect project_name" it gives me the following error:    No Django settings specified.   Unknown command: 'createproyect'   Type 'djang...
asked by 15.03.2017 / 20:18
1
answer

Modify the value of a field of a model depending on the date - Django

I have a model like this: class EdicionPrograma(models.Model): nombre_programa = models.ForeignKey(Programa) edicion = models.CharField( verbose_name="Edicion", blank=False, max_length=100 ) curso = models.Char...
asked by 23.02.2017 / 23:40
2
answers

ImportError: No module named urls, Creating view in django

Good evening I'm trying to create a view in Django and doing the runserver gives me the following error:    Performing system checks ...       Unhandled exception in thread started by Traceback (most recent call last): File   "C: \ Python27...
asked by 18.03.2017 / 00:04
1
answer

Assert when an object could not be created in Django

I am testing the creation of an object and would like to know how to do the test to make an assert in case the object could not be created. For example: def test_expediente_sin_nombre(self): try: Expediente.objects.create(...
asked by 24.04.2017 / 01:56
2
answers

Register a user from a form in Django

Hi, I have a model that inherits from AbstractUser: Models.py class Usuario(AbstractUser,models.Model): dni=models.CharField( verbose_name="DNI", max_length=9, blank=False, ) clave = models.CharField(...
asked by 14.02.2017 / 11:27
1
answer

update a single record with submit in index.html and function in views.py

I have a code which should allow me to update the field = status, by 'delivered' this is the index.html where the button is: <form action="/some/url/mapped/to/pedido_sub/view/"> <input type="submit" name="Aprobar" class="btn btn...
asked by 14.02.2017 / 16:20
1
answer

How to add a value from one table to another table with django

The point is to make an accounting entry. I'm using the admin of django and when I create a seat I must use two accounts (which already exist in the table account) and those add or subtract the value that entered the seat (total), the thing is t...
asked by 27.02.2017 / 06:21
1
answer

Python - Django - Sum too slow from a list

I have a Django project related to energy consumption, through which I visualize the consumption of a household during a month. To obtain that information, I use the following code: consumos = Measurement.objects.filter(idhogar=hogar) filtrado...
asked by 02.03.2017 / 12:02