Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django Formset with 1 extra mystery form
I have a formset on a template to allow the user to input the quantity for each item they would like to purchase. An odd thing occurred right after I committed my code to Git though. No matter the model for the formset, there is always an extra form, and I can't figure out why.... It's always the first form in the formset, and looks similar to this. Header1 | Header 2 | Header 3 | ------------------------------------------------------- (empty cell) | (empty cell) | (empty cell) | this is the extra mystery form form 1 data | form 1 data | form 1 data | form 2 data | form 2 data | form 2 data | form 3 data | form 3 data | form 3 data | Views.py def event_product_view(request, event_id): event = get_object_or_404(Event, pk=event_id) InvoiceLineItemFormSet = modelformset_factory( InvoiceLineItem, form=InvoiceLineItemForm, min_num=event.product_set.count()) formset = InvoiceLineItemFormSet( initial=[{'product': product, 'quantity': 0, 'user': User, 'name': product.product_name, 'description': product.description, 'price': product.price} for product in event.product_set.all()]) if (request.POST): ... context = {"event": event, "formset": formset, } return render(request, 'app/products.html', context) Forms.py class InvoiceLineItemForm(forms.ModelForm): name = forms.CharField(label='Name', disabled=True, required=False) description = forms.CharField(label='Description', disabled=True, required=False) price = forms.DecimalField(label='Price', max_digits=8, decimal_places=2, disabled=True, required=False) class Meta: model = InvoiceLineItem … -
@method_decorator(csrf_exempt) NameError: name 'method_decorator' is not defined
I was following the following guide (https://abhaykashyap.com/blog/post/tutorial-how-build-facebook-messenger-bot-using-django-ngrok) on how to create a chatbot, until the part where I updated the views.py. There seems to be some issue with the method declaration and I don't know what is wrong. Other than that, the code is almost exactly the same as the guide (with some imports that the guide creator forgot to add). Here is the error I got when trying to run the server in my virtual environment: (ivanteongbot) Ivans-MacBook-Pro:ivanteongbot ivanteong$ python manage.py runserver Performing system checks... Unhandled exception in thread started by <function wrapper at 0x1097a2050> Traceback (most recent call last): File "/Users/ivanteong/Envs/ivanteongbot/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(*args, **kwargs) File "/Users/ivanteong/Envs/ivanteongbot/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 121, in inner_run self.check(display_num_errors=True) File "/Users/ivanteong/Envs/ivanteongbot/lib/python2.7/site-packages/django/core/management/base.py", line 385, in check include_deployment_checks=include_deployment_checks, File "/Users/ivanteong/Envs/ivanteongbot/lib/python2.7/site-packages/django/core/management/base.py", line 372, in _run_checks return checks.run_checks(**kwargs) File "/Users/ivanteong/Envs/ivanteongbot/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "/Users/ivanteong/Envs/ivanteongbot/lib/python2.7/site-packages/django/core/checks/urls.py", line 14, in check_url_config return check_resolver(resolver) File "/Users/ivanteong/Envs/ivanteongbot/lib/python2.7/site-packages/django/core/checks/urls.py", line 24, in check_resolver for pattern in resolver.url_patterns: File "/Users/ivanteong/Envs/ivanteongbot/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/ivanteong/Envs/ivanteongbot/lib/python2.7/site-packages/django/urls/resolvers.py", line 310, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/Users/ivanteong/Envs/ivanteongbot/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/ivanteong/Envs/ivanteongbot/lib/python2.7/site-packages/django/urls/resolvers.py", line 303, in urlconf_module return import_module(self.urlconf_name) File … -
django NOT FOUND :1:views.decorators.cache.cache_header..07ecda68ff64bda8e9a1c01d6b375efa.ru.UTC
The server is django + memcached, i ordered all nastryki in Django config file and made the request to the page, do not tell me what could be wrong? django nothing like writing. And an error occurs in memcached. Log memcached: September 2 00:10:50 project systemd-memcached-wrapper [11153]:> 27 STORED September 2 00:10:50 project systemd-memcached-wrapper [11153]: 27: going from conn_nread to conn_write September 2 00:10:50 project systemd-memcached-wrapper [11153]: 27: going from conn_write to conn_new_cmd September 2 00:10:50 project systemd-memcached-wrapper [11153]: 27: going from conn_new_cmd to conn_waiting September 2 00:10:50 project systemd-memcached-wrapper [11153]: 27: going from conn_waiting to conn_read September 2 00:10:50 project systemd-memcached-wrapper [11153]: 30: going from conn_read to conn_parse_cmd September 2 00:10:50 project systemd-memcached-wrapper [11153]: <30 the get: 1: views.decorators.cache.cache_header..c3799174c539d82ae4c98ec78b9ab6c2.ru.UTC September 2 00:10:50 project systemd-memcached-wrapper [11153]:> NOT FOUND: 1: views.decorators.cache.cache_header..c3799174c539d82ae4c98ec78b9ab6c2.ru.UTC September 2 00:10:50 project systemd-memcached-wrapper [11153]:> 30 END September 2 00:10:50 project systemd-memcached-wrapper [11153]: 30: going from conn_parse_cmd to conn_mwrite September 2 00:10:50 project systemd-memcached-wrapper [11153]: 30: going from conn_mwrite to conn_new_cmd September 2 00:10:50 project systemd-memcached-wrapper [11153]: 30: going from conn_new_cmd to conn_waiting September 2 00:10:50 project systemd-memcached-wrapper [11153]: 30: going from conn_waiting to conn_read -
How to update Django Rest User attribute?
I have this model: class UserProfile(models.Model): user = models.OneToOneField(User, related_name='profile') stuff = models.TextField(default='') User.profile = property(UserProfile) With this serializer: class UserProfileSerializer(UserSerializer): stuff = serializers.SerializerMethodField() def get_stuff(self, obj): return obj.profile.stuff def update(self, instance, validated_data): instance.profile.stuff = validated_data.get('stuff', instance.profile.stuff) instance.save() return instance With this endpoint: class UpdateUserProfile(UpdateAPIView): model = UserProfile serializer_class = UserProfileSerializer permission_classes = [permissions.IsAuthenticated] def get_object(self): return self.request.user When I call HTTP/PUT to update my stuff field, it doesn't update. I don't know why. -
Ajax and UpdateView
Django 1.10 I would like to organize update via ajax. I know about AjaxableResponseMixin (https://docs.djangoproject.com/en/1.10/topics/class-based-views/generic-editing/#ajax-example). But don't I seem to be in need of a JsonResponse. Html would be fine for me. By the way, I experimented with the mixin - it doesn't solve my problem. Well, the the idea with ajax doesn't work. When I visit the direct update url in the browser, everything is fine: the model updates correctly. When I try to use ajax from DetailView, the model updates. But there is a the problem with getting data from the server. In Chrome dev tools while debugging js I occur in fail function. And jqXHR.status=0, textStatus = "error", errorThrown="". I try to go step by step in Django. In django/utils/autoreload.py I seem to occur in an infinite loop. The program enters while RUN_RELOADER loop. But never stops at my breakpoints (breakpoint 1 and breakpoint 2 in the code example). Well, it seems that the client doesn't get any response from the server in case of ajax. Could you give me a hint how to cope with this problem: how to diagnose it more precisely and what to do at all. autoreload.py def reloader_thread(): ensure_echo_on() if USE_INOTIFY: fn … -
How to loop through objects with FilePathField in Django to create static urls
I'm trying to create a html src attribute from a Django models' FilePathField called field1 whose path = static/dir/ Assigning values to field1 using the admin site will give it values like static/dir/value1.ext static/dir/value2.ext static/dir/value3.ext STATIC_URL is equal to '/static/' My question is how do I create static links for the values given that I am looping through the table for FilePathField so that I will have something like <source src='{% static "dir/value1.ext" %}' /> and also for value2,value3 object.field1 already evaluates to 'static/dir/value1' and so on -
Custom many to one manager on self
I'm trying to use a custom Manager on my model but would like it to also be used in the self relationship so I can add some code to the add method. Here's the code: from django.db import models class TestModelManager(models.Manager): use_for_related_fields = True def __init__(self): models.Manager.__init__(self) def add(self, *args, **kwargs): print('My custom code.') super().add(*args, **kwargs) class TestModel(models.Model): objects = TestModelManager() name = models.CharField(max_length=50) parent = models.ForeignKey( 'self', related_name='children', null=True, blank=True, ) Python shell output >>> from testmods.models import TestModel >>> TestModel.objects <testmods.models.TestModelManager object at 0x10bc96e80> >>> TestModel.objects.bulk_create([TestModel(name="foo"), TestModel(name="bar")]) [<TestModel: TestModel object>, <TestModel: TestModel object>] >>> t1, t2 = TestModel.objects.all() >>> t1.children.add(t2) >>> t1.children.all() <QuerySet [<TestModel: TestModel object>]> >>> In the line t1.children.add(t2) why didn't it print "My custom code."? -
How do I add a button to the submit row on the Django "Add new" admin page?
trying to figure out which parts of Django admin I need to extend/override to add a button to the submit row on the page where you add a new instance of a model. Ideally this button doesn't lead to a new URL or anything, just triggers some logic via a "POST" method (to export data). I found the submit-line.html template on the django github page but not sure how to override it/what I need to do to actually get my button to work. I have checked out similar q's (this one, this one, this one, etc) but they all seem to involve writing a regex for the button and redirecting to a new URL, which seems like more than I would need to do. Any guidance much appreciated. -
inbuilt admin page in django 1.10 python 3.4 with peewee and pymysql throwing error
I am using django for my application. To create Builtin admin page i configured some files, which are as follows 1. to connect with mysql I have used pymysql, for configuring in project's __init__.py file try: import pymysql pymysql.install_as_MySQLdb() except: pass 2. In project's urls.py from django.conf.urls import url,include from django.contrib import admin from story import views admin.autodiscover() urlpatterns = [ url(r'^admin/',include(admin.site.urls)), url(r'^$', views.home, name="home"), ] 3. In project's settings.py introduced my app in INSTALLED_APPS 4. In app of project's models.py from peewee import * database = MySQLDatabase('mysite', **{'user': 'root', 'password': 'pwd'}) class UnknownField(object): def __init__(self, *_, **__): pass class BaseModel(Model): class Meta: database = database class User(BaseModel): name = CharField(null=True) class Meta: db_table = 'user' This code is generated through pwiz command of peewee. 5. in app of project's admin.py from django.contrib import admin from story.models import User admin.site.register(User) when I run />python manage.py runserver command gives me error "AttributeError: 'ModelOptions' object has no attribute 'abstract'" Please suggest me what could be the possible solution. Thanks -
django conditional max for each with foreign key
consider these models: class Author(models.Model): name = models.CharField(max_length=200) class Book(models.Model): author = models.ForigenKey(Author) name = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True) active = models.BooleanField(default=True) I want to query all the Authors, with the latest(e.g Max('created_at') ) book of them in the same row, but only when the book is active=True. If there is no such a book - all are active=False, or they simply do not exist - the query should output NULL where needed instead of the a book . I've tried to write something like this: Author.objects.annotate(max_book_date=Max('book')) which does work, but it's missing additional fields on the book, and I'm not sure how it works in case of null (i.e no books), and the active=True condition is not there.. -
how to access to an element of the conext in django
I'm trying to access to the elements of the get_context_data like: context = super(DetallePlanillasContratado,self).get_context_data(**kwargs) and then access in this way: context['new_context'] = context.elements_of_the_context do we have something like this on django? -
user template tag disappearing in django for loop
in my django template I have this basic code. the {{ user.id }} displays as long as I'm outside of the for loop. Inside the for loop nothing is returned or displayed. Totally frustrated right now. permission(perms) does not work inside the for loop. Does anyone have any ideas? <table> <tr> <td colspan=2">{{ user.id }}</td> </tr> {% for item in object_list %} <tr> <td>{{ user.id }}</td> <td>{{ item.title }}</td> </tr> {% endfor %} </table> item.title displays correctly. the first time use {{ user.id }} id displays. Any user.id called in for loop does not display. This is the most simplified version of the code I have tried and it just doesn't want to work. Anyone have any ideas? -
How to create Flask default User
I am following Miguel Grinberg's "Flask Web Development" Book. Here, I can not assign default role to my user. e.g when people signup to my site he/she will be assigned a role. For example I have define three roles named, Admin, Moderator and User. I want to assign User role to all my user also I want to assign Moderator role and also assign Admin role to specific user. Here is my models.py(http://pastebin.com/WbWTE8Pf) file. Please, do help me. Thanks -
Django Cache auto refresh when Data is changed
Is there any way to notify django to refresh the cache if there were any changes made on the database related to the cache data ? I have found this post, there is no latest answer and the django version mentioned was 1.6. I looked into the cache documentation and haven't found anything that directly relates to the question. My question is what if I cache a result of a database query and there are new records added in between the timeout for the cache from django.core.cache import cache results = MyModel.objects.all() # 4 count cache.set('results', results ) # Cached for 5 mins # Mean while records have been added to MyModel table results = MyModel.objects.all() # 6 count cache.get('results') # 4 count and would not be updated for 5 mins Is there any way to check if there has been any addition to the database and the cache refresh whenever there has been addition or deletion of records from the database ? I have close to 10 tables where this might be important. Where whenever a records has been changed, the cache has to be updated. Any help or suggestions are much appreciated. Project Stack: Django: 1.9 Python: 3.5 … -
How to run django runserver over TLS 1.2
I'm testing Stripe orders on my local machine. I receive an error: Stripe no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later. I am using django 1.10 and python version 2.7.10 How can I force the use of TLS 1.2? Would I do this on the python or django side? -
Django TemplateSyntaxError when combining template tags
Let say users can access the following urls in Django, someUrl/one someUrl/two someUrl/three one, two, and three comes from a table such that I can access them with the ORM for example, tableName.number. My question is how do I write them in my template,I tried with <source src="{% static "someUrl/{{ tableName.number }}" "%}"/> but I am getting a TemplateSyntaxError. What is the correct way to do it? -
Is it possible to run ubuntu terminal commands using DJango
I am designing a simple website using DJango and my database is HBase. In some Part I need to save some files on HDFS, for example video file, and have it's URI. But my problem is I couldn't find any API for accessing HDFS through DJango so I decided to use ubuntu terminal command to upload and download data on HDFS. Now I want to know is there any way to run terminal command using Django ? -
Installing PIP on Windows 10 python 3.5
I just started learning Python, and successfully downloaded Python 3.5. I attempted to download/upgrade PIP 8.1.2 multiple times using get-pip.py, which I ran (successfully I think) but when I attempted to execute python get-pip.py I got the error code: File "<stdin>", line 1 python get-pip.py ^ SyntaxError: invalid syntax I understand that pip is included in python but the pip website requires users to upgrade pip which I don't think I can since any pip commands lead to syntax errors, and do not produce the same output that most tutorial sites show. I have tried to find different ways to fix it, but I can't figure out whats wrong aside from pip not being on the computer in the first place or corrupted. Thank you for your assistance. -
Flash Player removing AUTHORIZATION header even with crossdomain.xml
I have a Flash application that performs simple GET requests to the same server where it is located but also perform other GET requests to another server (a Django application). These requests made to the other server use include the Authorization header. The problem is that this header is being removed somewhere even though it was added in the AS3 code. As noted on Adobe documentation the Authorization header is removed by the Flash Player unless ordered by the crossdomain.xml file. I followed the instructions but it didn't work. This was probably because that crossdomain file was designed to make requests to the same server where the swf is located. So I added the crossdomain.xml file on the other server and tried many configurations but none of them worked. Next are the different configurations I used on the second server: crossdomain.xml A: <?xml version="1.0" ?> <cross-domain-policy> <allow-http-request-headers-from domain="*" headers="Authorization"/> </cross-domain-policy> crossdomain.xml B: <?xml version="1.0" ?> <cross-domain-policy> <allow-access-from domain="*" secure="false"/> <site-control permitted-cross-domain-policies="all"/> <allow-http-request-headers-from domain="*" headers="*" secure="false"/> </cross-domain-policy> crossdomain.xml C: <?xml version="1.0" ?> <cross-domain-policy> <allow-access-from domain="*" secure="false"/> <site-control permitted-cross-domain-policies="all"/> <allow-http-request-headers-from domain="*" headers="Authorization"/> </cross-domain-policy> Next is the crossdomain.xml file stored in the main server where the swf file is located: <?xml version="1.0" ?> … -
Sending message in Django app on Heroku - Server Error
i've done some app in django. In app everyone are allowed to send message. Everythings works on my local server, but when i upload it to the Heroku, the option with messages didn't work - getting everytime Server Error 500 and i have no idea why. Here is my code: views.py form = SendMessageForm(request.POST or None) if form.is_valid(): human = True form_message = form.cleaned_data.get("message") email = form.cleaned_data.get("email") subject = form.cleaned_data.get("subject") from_emial = settings.EMAIL_HOST_USER to_email = ['##########'] contact_message = "%s \n\nfrom %s" %(form_message, email) send_mail(subject, contact_message, from_emial, to_email, fail_silently=False) return HttpResponseRedirect('/') con = { "form": form, "all_profiles":all_profiles, } return render(request, "home.html", con) and some of my settings.py DEBUG = True ALLOWED_HOSTS = [] EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = '#####' EMAIL_HOST_PASSWORD = '#####' EMAIL_PORT = 587 EMAIL_USE_TLS = True Thanks for the any help. -
Modify validation of fieldset in Mezzanine/Django
How could I modify Mezzanine keywords to validate differently? Source code of admin: http://mezzanine.jupo.org/docs/_modules/mezzanine/blog/admin.html I need to do the following validation: This is a tag --> thisisatag Tag --> tag tag --> tag How could I modify the fieldset for keywords for a blogpost If I unregister the blogpost and register it again and doing a deepcopy? This is my current code: blogpost_fieldsets = deepcopy(DisplayableAdmin.fieldsets) blogpost_fieldsets[0][1]["fields"].insert(1, "categories") blogpost_fieldsets[0][1]["fields"].extend(["content", "allow_comments"]) blogpost_list_display = ["title", "user", "status", "admin_link"] if settings.BLOG_USE_FEATURED_IMAGE: blogpost_fieldsets[0][1]["fields"].insert(-2, "featured_image") blogpost_list_display.insert(0, "admin_thumb") blogpost_fieldsets = list(blogpost_fieldsets) blogpost_fieldsets.insert(1, (_("Other posts"), { "classes": ("collapse-open",), "fields": ("related_posts",)})) blogpost_list_filter = deepcopy(DisplayableAdmin.list_filter) + ("categories",) @admin.register(BlogPost) class BlogPostCustomAdmin(TweetableAdminMixin, DisplayableAdmin, OwnableAdmin): """ Custom admin class for blog posts. """ fieldsets = blogpost_fieldsets list_display = blogpost_list_display list_filter = blogpost_list_filter filter_horizontal = ("categories", "related_posts",) def save_form(self, request, form, change): """ Super class ordering is important here - user must get saved first. """ OwnableAdmin.save_form(self, request, form, change) return DisplayableAdmin.save_form(self, request, form, change) admin.site.unregister(BlogPost) -
Issue deploying Django project to Apache via WSGI
Ubuntu 14.04.4 and Django 1.10 I'm trying to deploy a simple Django app that works perfectly in development to Apache, via WSGI. The relevant bits in my Apache config file: <VirtualHost [my IP]> WSGIScriptAlias /Django/MedFormUpdates /home/web/inside/django/MedFormUpdates/MedFormUpdates/wsgi.py WSGIApplicationGroup %{GLOBAL} </VirtualHost> WSGIPythonPath /home/web/inside/django/MedFormUpdates/MedFormUpdates <Directory "/home/web/inside/django/MedFormUpdates/MedFormUpdates"> Options ExecCGI <Files wsgi.py> Require all granted </Files> </Directory> In my wsgi.py file: import os, sys from django.core.wsgi import get_wsgi_application sys.path.append('/home/web/inside/django') sys.path.append('/home/web/inside/django/MedFormUpdates') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MedFormUpdates.settings") application = get_wsgi_application() And in my settings.py: WSGI_APPLICATION = 'MedFormUpdates.wsgi.application' When I attempt loading the page, I get "We're sorry, the web server had an internal error." - with the Apache log showing End of script output before headers: wsgi.py I've been through every Django/WSGI/Apache thread that I can find, and this is driving me nuts. Any insight is appreciated. Thanks. -
Django Oscar API Basket Strategy
We have an eCommerce project using Django Oscar with an API using Django Oscar API project. In my settings I have added 'oscar.apps.basket.middleware.BasketMiddleware', to the MIDDLEWARE_CLASSES. My rest framework settings are as follows REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.BasicAuthentication', 'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.TokenAuthentication', ) } I am able to login users and create baskets by following the Examples here, but for some reason my baskets don't have a strategy assigned to them. This means I can't add a product to the basket and I get this error IntegrityError at /api/basket/add-product/ null value in column "price_currency" violates not-null constraint DETAIL: Failing row contains (76, 230_228, 1, null, null, null, 2016-09-01 16:28:20.347866+00, 1226, 230, 228). This is despite having a stock record url attached to the product. My stock records look like this. { "id": 228, "partner_sku": "89184e79-af07-44af-ba43-3a29c507d590", "price_currency": "Ksh", "price_excl_tax": null, "price_retail": "12000.00", "cost_price": "12000.00", "num_in_stock": 18, "num_allocated": null, "low_stock_threshold": null, "date_created": "2016-08-26T16:00:00.202475Z", "date_updated": "2016-08-26T16:00:00.202536Z", "product": 230, "partner": 602 } I didn't start this project and I am new to Django Oscar so I know I'm just missing a setting somewhere but I would appreciate some help. -
Using Fetch API to POST Form Data to Django
I'm attempting to create fetch instance where I hit a POST route in my Django application. This route is expecting typical form data to be accessible on the request.POST QueryDict, but it comes back empty each time. Here is my fetch call in a React component: const body = new FormData(); body.append("survey", this.props.survey.pk); body.append("responses", data); fetch(self.props.updateUrl, { method: 'POST', credentials: "include", headers: { 'X-CSRFToken': csrftoken, //defined earlier 'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded', 'X-Requested-With': 'XMLHttpRequest' }, mode: 'cors', cache: 'default', body: body }).then(response =>{ if (response.status >= 200 && response.status < 300) { //Success stuff. } else { //Throw error here. } }).catch(error => { //Handle error }); And here's the basic gist of the route on the server: def import_survey_responses(request): if request.is_ajax(): survey_id = request.POST.get('survey', '') responses = request.POST.get('responses', '') survey = get_object_or_404(SurveyForm, id = survey_id) But the end results is always an empty request.POST. Is there something basic I'm missing about fetch or Django here (definitely a noob to Django)? -
How to server-render events in calendar
I'm creating a weekly event calendar, like Google Calendar/iCloud Calendar. I prefer to render on the server. Below is my progress so far in my Django template. I have created the timetable itself, but How do I render the events? Django template: {% extends 'base.html' %} {% block content %} <div id="schedule"> <h3 class="title">Schedule</h3> <h4 id="schedule-period">Week {{ today | date:"W" }}, {{ today | date:"Y" }}</h4> <div id="timetable">{{ events }} <div id="week-hours"> {% for hour in hours %} <div class="week-hour"> <small>{{ hour }}</small> </div> {% endfor %} </div> {% for date in week_dates %} <div class="week-day"> <div class="week-day-header"> <p class="week-day-name">{{ date | date:"l" }}</p> <h4 class="week-day-number">{{ date | date:"j" }}</h4> </div> <div class="{% if date == today %} week-day-body-highlight{% else %}week-day-body{% endif %}"> {% for hour in hours %} <div class="day-hour"> </div> {% endfor %} </div> </div> {% endfor %} </div> </div> {% endblock %}