Questions tagged as 'django'

1
answer

I want to render a list in a template

views.py def main(request): list=Hotel.objects.all() template = get_template("index.html") return HttpResponse(template.render({'list': list[0:max]})) index.html <!DOCTYPE html> <html> <head> <meta charset='...
asked by 28.04.2016 / 09:42
1
answer

How to use an attribute of the User model that Django has by default?

What I want to do is, be able to use the first name of the user that is registered in the database using the User model that django has by default, my idea is to use its name as a sort of selector with a foreign key, so that when I save my docum...
asked by 28.05.2018 / 22:37
1
answer

How to condition serializer? DjangoRestFramework

I have the following serializer: class PerfilSerializer(serializers.ModelSerializer): usuario = UserSerializer() seguidores = serializers.PrimaryKeyRelatedField(many=True, read_only=True) looks = LookSerializer(many=True, read_only...
asked by 16.05.2018 / 16:18
2
answers

How to render the form from the template and see it in admin

I'm using Django 1.11.4, root app url(r'^contacto/', include('contacto.urls'), name='contacto'), contact_app / urls.py from django.conf.urls import url, include from contacto.views import contacto urlpatterns = [ url(r'^$',...
asked by 08.05.2018 / 02:12
1
answer

Problems with Django, when installing the cymysql plugin to connect to the database

What I am using: Operating system: Debian 9 Database: MySQL 5.5 Django 1.11.4 I execute the command: python manage.py migrate The following error message is displayed in the terminal: django.core.exceptions.ImproperlyConfigured...
asked by 28.02.2018 / 04:46
2
answers

error regexp django urls

Why Django does not recognize my url? my urls.py from django.urls import path from home.views import homePageView, activateUser urlpatterns = [ path('',homePageView.as_view(),name='home'), path('activate/([a-zA-Z0-9]{15})/$', act...
asked by 26.06.2018 / 19:27
1
answer

ImportError at post / new when creating a form with Django

I'm starting at DJango and I have some doubts about the forms, here's the code, I'd appreciate your help: D This is the error that appears: Directories and files: blog |--_pycachce_ |--migrations |--static |-...
asked by 15.01.2018 / 18:23
1
answer

What kind of queryset can I do, to order type of strategy in conservative, moderate and risky?

This is my class: class FirFondoDistribucionAdmin(admin.ModelAdmin): """ Administrador de las distribuciones de dichos fondos """ list_display = ('fondo', 'tipo_distribucion', 'porcentaje', 'is_activo', 'fecha') admin.s...
asked by 03.07.2018 / 18:46
1
answer

How to update django in visual studio?

Hello, I have all installed version 2.0.2 of django and it works fine, but I have noticed that when creating a project with visual studio, version 1.9 appears, I am very confused and I would also like to develop a project created with cmd in vis...
asked by 02.02.2018 / 04:11
1
answer

Return a queryset from request data

I have the following model: class Actividad(models.Model): nombre = models.TextField() es_principal = model.BooleanField() fecha_inicio = DateField() fecha_fin = DateField() dirigente = TextField() And this is your vi...
asked by 19.01.2018 / 15:07