Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django FormWizard done function saves each step (form) as a separate instance in DB
I've searched all over for a solution to this but just can't figure it out. I feel the solution is quite simple but... I have a formwizard - class FormWizardView(SessionWizardView): template_name = "requests/data_change_requests.html" form_list = [dc_step1, dc_step2] def done(self, form_list,**kwargs): for form in form_list: form.save() return HttpResponseRedirect ('success.html') when the Done function is run, each step in the form is saved as a separate instance in the DB. how can I tie both form instances together and then save that so it is all in the instance? Thanks -
Django templates Could not parse the remainder
I have this template, I am looping through all choices in a question, and I want to default check the question user previously selected. selected_choice variable is coming from my view and I got have it ok in my template. {% extends 'base.html' %} {% block content %} <div id="detail" class=""> <form hx-post="{% url 'main:vote' question.id %}" hx-trigger="submit" hx-target="#detail" hx-swap="outerHTML"> {% csrf_token %} <fieldset> <legend><h1>{{ question.question_text }}</h1></legend> {% if error_message %}<p> <strong>{{ error_message }}</strong> </p> {% endif %} {% for choice in question.choices.all %} <input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}" {% if selected_choice and choice.id==selected_choice %}checked{% endif %}> <label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br> {% endfor %} </fieldset> <button type="submit">Submit</button> </form> </div> {% endblock content %} I get this error Could not parse the remainder: '==selected_choice' from 'choice.id==selected_choice' -
Django ReactJS web app Icons and Images Inside Public Folder Not Showing
I'm trying to deploy a small Django/ReactJS web app to heroku. I'm having an issue with the static images used as background and icons (the images folder is inside the public folder). The images do not show. However, when I deploy only the frontend part as a static app, the images show correctly. All the Django/ReactJS project I've been able to access so far have images imported inside App.js, it's not what I want to do. I want to use the urls to the images as for example: background: "url(/images/somemage.png)" Website without backend: https://base-apparel-coming-soon-react.herokuapp.com/ Website with backend: https://base-apparel-coming-soon-dr.herokuapp.com/ Git repository: https://github.com/.../base-apparel-coming-soon-DRF.../ -
Reservation system Djangop [closed]
I am trying to develop a reservation system based on a Django project. My final goal is to have something like that: Until now, what I was able to achieve is to have the table with the times of the day and the column (which are aicrafts). My final goal is to have my reservations displayed as "legs", meaning that for example a reservation from 09:00 until 11:00 is displayed in the aircraft cells between 09:00 up to 11:00. So far my code is something like that: models.py class AirportTime(models.Model): aerodrome = models.ForeignKey(Aerodrome, on_delete=models.CASCADE, blank=True, null=True) opening_time = models.TimeField() closing_time = models.TimeField() created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) def __str__(self): return str(self.opening_time) + ' ' + str(self.closing_time) class Booking(models.Model): aircraft = models.ForeignKey(Aircraft, on_delete=models.CASCADE) student = models.ForeignKey( Student, on_delete=models.CASCADE, blank=True, null=True) instructor = models.ForeignKey( Instructor, on_delete=models.CASCADE, blank=True, null=True) date = models.DateField() start_time = models.TimeField() end_time = models.TimeField() created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) def __str__(self): return self.aircraft.registration + ' ' + str(self.date) + ' ' + str(self.start_time) + ' ' + str(self.end_time) views.py def index(request, date): if date is None: date_obj = datetime.now().date() else: date_obj = datetime.strptime(date, '%Y-%m-%d') next_day_obj = date_obj + timedelta(days=1) next_day_link = next_day_obj.strftime('%Y-%m-%d') prev_day_obj = date_obj - timedelta(days=1) … -
Passing secret variables Django to Javascript [closed]
Is there some way to not show variables in Django Template Ninja, or hidden them in Javascript for not show in Source Code? <div id="scriptBlock" style="display:none;"> <input type="hidden" id="username_api" value="{{ username }}"> <input type="hidden" id="password_api" value="{{DATA_API.password }}"> <input type="hidden" id="grant_type" value="{{DATA_API.grant_type }}"> <input type="hidden" id="scope" value="{{ DATA_API.scope }}"> <input type="hidden" id="client_id" value="{{ DATA_API.client_id }}"> <input type="hidden" id="client_secret" value="{{ DATA_API.client_secret }}"> <script> var username = document.getElementById('username_api').value.replace(/&quot;/g,"\"") var password = document.getElementById('password_api').value.replace(/&quot;/g,"\"") var grant_type = document.getElementById('grant_type').value.replace(/&quot;/g,"\"") var scope = document.getElementById('scope').value.replace(/&quot;/g,"\"") var client_id = document.getElementById('client_id').value.replace(/&quot;/g,"\"") var client_secret = document.getElementById('client_secret').value.replace(/&quot;/g,"\"") I tried to remove input hidden after get the variable, but they are showed in source code anyway. let scriptBlock = document.getElementById('scriptBlock') scriptBlock.parentElement.removeChild(document.getElementById('geonames_api')); scriptBlock.parentElement.removeChild(document.getElementById('google_maps')); scriptBlock.parentElement.removeChild(document.getElementById('username_api')); -
why does python3.6 container uses the /usr/lib of python 3.9
I start a docker contain with FROM python:3.6 It installs both python 3.6 and 3.9 as I noticed: All pips I installed are in 3.6 including mysqlclient But when it tries to import _mysql, it checks the /usr/lib of python3.9 which gives an error because it in 3.6 not 3.9. File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module ImportError: cannot import name '_mysql' from partially initialized module 'MySQLdb' (most likely due to a circular import) (/usr/local/lib/python3.6/site-packages/MySQLdb/__init__.py) Why doe this issue happen and how to prevent it? Here are the logs for the django application, I get the error: [Thu Mar 10 11:19:44.400586 2022] [wsgi:error] [pid 12660:tid 139881606039296] [client 172.23.0.1:43972] mod_wsgi (pid=12660): Exception occurred processing WSGI script '/var/www/html/project/project/wsgi.py'., referer: http://localhost:8005/request/outgoing/ [Thu Mar 10 11:19:44.423410 2022] [wsgi:error] [pid 12660:tid 139881606039296] [client 172.23.0.1:43972] Traceback (most recent call last):, referer: http://localhost:8005/request/outgoing/ [Thu Mar 10 11:19:44.423482 2022] [wsgi:error] [pid 12660:tid 139881606039296] [client 172.23.0.1:43972] File "/usr/local/lib/python3.6/site-packages/MySQLdb/__init__.py", line 18, in <module>, referer: http://localhost:8005/request/outgoing/ [Thu Mar 10 11:19:44.423498 2022] [wsgi:error] [pid 12660:tid 139881606039296] [client 172.23.0.1:43972] from . import _mysql, referer: http://localhost:8005/request/outgoing/ [Thu Mar 10 11:19:44.423533 2022] [wsgi:error] [pid 12660:tid 139881606039296] [client 172.23.0.1:43972] ImportError: cannot import name '_mysql' from partially initialized module 'MySQLdb' (most likely due to a circular import) (/usr/local/lib/python3.6/site-packages/MySQLdb/__init__.py), … -
after upgrade python version 3.9 my virtualenv Import "django_filters.rest_framework" could not be resolved
After upgrading python version 3.8 to 3.9, I have an issue in my virtual environment Import "django_filters.rest_framework" could not be resolved. enter code here from django_filters.rest_framework import DjangoFilterBackend class Reviewlist(generics.ListAPIView): serializer_class = ReviewSerializer filter_backends = [DjangoFilterBackend] filterset_fields = ['review_user__username', 'active'] def get_queryset(self): pk = self.kwargs['pk'] return Review.objects.filter(watchlist=pk) -
Building a django app in Travis CI not successful
I am trying to integrate Travis CI with Django application. But I am getting the following error Successfully built 9b60427cea1c Successfully tagged 3_recipe_app_app:latest WARNING: Image for service app was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`. Creating 3_recipe_app_app_run ... System check identified no issues (0 silenced). ---------------------------------------------------------------------- Ran 0 tests in 0.000s OK ./app/settings.py:23:80: E501 line too long (81 > 79 characters) ./app/settings.py:89:80: E501 line too long (91 > 79 characters) ./app/settings.py:92:80: E501 line too long (81 > 79 characters) ./app/settings.py:95:80: E501 line too long (82 > 79 characters) ./app/settings.py:98:80: E501 line too long (83 > 79 characters) ERROR: 1 The command "docker-compose run app sh -c "python manage.py test && flake8"" exited with 1. Done. Your build exited with 1. .travis.yml language: python python: - "3.6" services: - docker before_script: pip install docker-compose script: - docker-compose run app sh -c "python manage.py test && flake8" .flake8 [flake8] exclude = migrations __pycache__, manage.py, settings.py Dockerfile FROM python:3.7-alpine LABEL maintainer="hans" ENV PYTHONUNBUFFERED 1 COPY ./requirements.txt /requirements.txt RUN pip install -r /requirements.txt RUN mkdir /app WORKDIR /app COPY ./app /app RUN adduser -D user USER user docker-compose.yml version: "3" … -
Difference between import appname.models and from appname.models.ModelName in Djano
As a programming style, I find it more useful to write the following: import appname.models obj = appname.models.ModelName.objects.filter(status=1) However, I find lot of code written where only the ModelName is imported: from appname.models import ModelName obj = ModelName.objects.filter(status=1) However, I often come across the scenario, where the change in the ModelName result in the application breaking and we need to make changes everywhere. Also, from a readability perspective, the second approach, I find it very difficult know, where was the model defined(which app). I have been insisting my team to go with the first approach. Wanted to hear your thoughts which is the best approach from the following perspective: Readability Scalability Performance I really appreciate all your thoughts here. -
Django Rest Framework prefetching data
I would like to minimize number of queries to get data. I have 3 models: class SubCategory(models.Model): game = models.ForeignKey(Game, verbose_name=_("Gra"), on_delete=models.CASCADE) name = models.CharField(verbose_name=_("Nazwa"), max_length=40) ... class GameTask(CloneModel): game = models.ForeignKey(Game, verbose_name='Gra', related_name='tasks', on_delete=models.CASCADE) name = models.CharField(verbose_name='Nazwa', max_length=200) subcategory = models.ForeignKey(SubCategory, verbose_name=_("Podkategoria"), on_delete=models.SET_NULL, blank=True, null=True) class TaskLevel(CloneModel): name = models.CharField(max_length=50) master_task = models.ForeignKey(GameTask, related_name='sub_levels', on_delete=models.CASCADE) My subcategory view looks like: class SubCategoryList(ListAPIView, PermissionMixin): permission_classes = (permissions.IsAuthenticated,) serializer_class = SubCategorySerializer def get_queryset(self): return SubCategory.objects.filter(game=self.get_game()).order_by("slug") and my SubCategorySerializer: class SubCategorySerializer(serializers.ModelSerializer): developments = SubCategoryDevelopmentSerializer(many=True, read_only=True) in_progress = serializers.SerializerMethodField() class Meta: model = SubCategory fields = ("id", "name", "slug", "description", "image", "developments", "in_progress") def get_in_progress(self, obj: SubCategory): user = self.context["request"].user subcategory_tasks = obj.gametask_set.all() // rest of the logic All I want to achieve is to return only tasks, which are related to TaskLevel model as master_task. I was trying using subcategory_tasks = obj.gametask_set.all().prefetch_related("sub_levels") but the amount of queries was the same. Could somebody give my any hint how to solve this? -
Django How to know if an object exist and has a value that is equal to an object of same model
Here in my code, I have a models that collects data of users for a particular foreignkey object. Now I want it in a way that if an ip_address has visited a particular DetailPage, I create an instance. But now, if an IP address has already visited this particular detail page, I don't want it to create an instance anymore, instead it should update the instance. But now this is where the problem lies; if an IP address has visited a particular IP address (my first DetailPage) and now tries to visit my second DetailPage object, it does not create an instance because the IP address already exists. I want it to create an instance because the logistic foreignkey is a different foreignkey (my Second Detail Page) and not the first because this IP address was in the first. Here's my code below: models.py class UserVisitOfLogisticDetailPage(models.Model): logistic = models.ForeignKey(Logistic, null=True, on_delete=models.SET_NULL) user_ip_address = models.CharField(max_length=255, null=True, blank=True) user_latitude = models.CharField(max_length=255, null=True, blank=True) user_longitude = models.CharField(max_length=255, null=True, blank=True) user_city_location = models.CharField(max_length=255, null=True, blank=True) user_country_location = models.CharField(max_length=255, null=True, blank=True) user_device_type = models.CharField(max_length=255, null=True, blank=True) user_browser_type = models.CharField(max_length=255, null=True, blank=True) user_browser_version = models.CharField(max_length=255, null=True, blank=True) user_os_type = models.CharField(max_length=255, null=True, blank=True) user_os_version = models.CharField(max_length=255, null=True, … -
How can i display data from my REST API in a React JS Schedule
Everyone, On the coloured cells are data comming from my static JSON file and i want to change it, to data comming from a REST API, how can i do? So! I want to know how can I fetch data from my REST API to my schedule. I want to take the name and the date. The date will automatically be allocated to the correspondent schedule date and be displayed. Help please! -
Django Validate URLs in a List
I have an emtpy list called 'to_be_directed' that I save in direct.py file. I store all the previous links that user visited in that list up to 10 times. I save that list to redirect the user. However some links might be dead. Therefore, I like to check the links in the list with an order and redirect the user from latest proper link. However I see that requests library doing it multiple times. Although there are 1 link in the list, I see that it's going up to 10 times. How can I manage to redirect the users from latest active link in the list ? views.py from . import direct # here I save the visited links in to_be_directed list previous = self.request.META.get('HTTP_REFERER') direct.to_be_directed.insert(0, previous) if len(direct.to_be_directed) >= 10: direct.to_be_directed.pop() # here I check the links if they are dead; import requests for i in direct.to_be_directed: print('***************** i printed: ', i) try: print('************** status: ', requests.get(i).status_code) except: print('************ ERR') direct.py to_be_directed = [] outcome of prints [10/Mar/2022 14:29:55] "GET /actions/acbadem-admin-15f0ed1d/ HTTP/1.1" 200 68324 ************** status: 200 ***************** i printed: None ************ ERR ***************** i printed: None ************ ERR ***************** i printed: None ************ ERR ***************** i printed: None … -
Django-App s3 bucket not working properly
So I'm currently deploying my website on heroku and I want to serve the static and media files from AWS S3, and at this point the files are being served from aws but the styling is not being applied. This are my settings: AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID') AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY') AWS_STORAGE_BUCKET_NAME = os.environ.get('AWS_STORAGE_BUCKET_NAME') AWS_S3_FILE_OVERWRITE = False AWS_S3_CUSTOM_DOMAIN = f'{AWS_STORAGE_BUCKET_NAME}.s3.amazonws.com' AWS_S3_OBJECT_PARAMETERS = {'CacheControl' : 'max-age=86400'} AWS_DEFAULT_ACL = 'public-read' AWS_S3_REGION_NAME = 'eu-west-3' # AWS_S3_SIGNATURE_VERSION = 's3v4's3 AWS_LOCATION = 'static' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static') ] STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage' STATIC_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/{AWS_LOCATION}/' DEFAULT_FILE_STORAGE = "joaoLina.storages.MediaStorage" MEDIA_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/media/' I have the right permissions on my bucket and as you can se the files are being served from aws: So if someone knows what I'm missing I would be glad to know. -
Django custom widget: how to access field error?
I try to have more control over form rendrering and template. Initially, I used django-crispy but event if Layout give huge range of customization I thought it became confused... So I truned out to widget customization following django documentation and this site https://www.webforefront.com/. I first face issue with renderding field label. I fix that by passing label argument in attrs of CustomWidget but not sure it is a good practice. But my main issue is rendering erros... How can I manage this? template for input CustumoInput.html <div class="row mb-0"> <div class="input-group input-group-sm col-6 rounded"> <label>{{ widget.label }}</label> </div> <div class="input-group input-group-sm mb-1 col-2"> <input type="{{ widget.type }}" name="{{ widget.name }}" id="id_{{ widget.name }}" class = "textinput textInput form-control" {% if widget.value != None %} value="{{ widget.value }}" {% endif %} {% include "django/forms/widgets/attrs.html" %} /> {% for error in widget.errors %} <div class="invalid-feedback">{{ error }}</div> {% endfor %} </div> </div> widgets.py from django import forms class custom_input(forms.widgets.Input): template_name = 'ecrf/CustomInput.html' input_type = 'text' def __init__(self, attrs={}): super(custom_input, self).__init__(attrs) def get_context(self, name, value, attrs): context = super(custom_input, self).get_context(name, value, attrs) context['widget']['label'] = self.attrs['label'] context['widget']['attrs']['placeholder'] = self.attrs['placeholder'] context['widget']['attrs']['autocomplete'] = self.attrs['autocomplete'] context['widget']['attrs']['data-mask'] = self.attrs['data-mask'] return context forms.py self.fields['inc_tai'] = forms.IntegerField(label = 'Taille (mesurée … -
Error when i try to load mysqldb for jupyter notebook or python shell
Since i changed the connection to a mysql db, i get a error of mysql django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. this is my conf: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'myophio_dev', 'USER': 'root', 'PASSWORD': 'password', 'HOST': '192.168.1.84', 'PORT': '113' } } In mysql workbench i can access the data. So, I don't know what is wrong. I am using a macOS 11. Can you help me? Python version: 3.10.2 also, i already did brew install mysql and brew reinstall mysql, brew restart services mysql I dont know what else I can do. -
Filter A foreignkey child model instance in a form field based on the parent value selected in another field in the same field
I would enter image description herelike to list getionnaire in the Projetform based on departement chosen in the another field of the same. -
Django User model with same fields
I saw tutorial on how to extend django model by giving 1-to-1 relationship to the django user model. My question is, if we have same fields on both User and profile(extend from user) model i.e email and username. When the user register on our site using User model, does the profile model will inherit the same username and email from User model? from django.contrib.auth.models import User class Profile(models.Model): user = models.OneToOneField( User, on_delete=models.CASCADE, null=True, blank=True) name = models.CharField(max_length=200, blank=True, null=True) email = models.EmailField(max_length=500, blank=True, null=True) location = models.CharField(max_length=200, blank=True, null=True) -
Modifying django-allauth error messages on a signup form
I'm currently building a website that makes use of django-allauth and I've come across a problem regarding error messages while using a custom User model. My custom User model is called CustomUser, I've noticed that when django-allauth handles errors regarding the username, it uses the name of the user model as the starting word to the error message's sentence. Example image is linked below. Image of the error message How can I change this error message? I'd like to stay away from overriding any django-allauth views if possible, though I'd be happy with any solution! This is my Django form code that makes use of django-crispy-forms: <form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}"> {% csrf_token %} <div class="row"> <div class="col-12 col-lg-7"> {{ form.email|attr:"autofocus"|as_crispy_field }} </div> <div class="col-12 col-lg-5"> {{ form.username|as_crispy_field }} </div> <div class="col-6 col-lg-4"> {{ form.first_name|as_crispy_field }} </div> <div class="col-6 col-lg-4"> {{ form.last_name|as_crispy_field }} </div> <div class="col-12 col-lg-4"> {{ form.birthday|as_crispy_field }} </div> <div class="col-12 col-sm-6"> {{ form.password1|as_crispy_field }} </div> <div class="col-12 col-sm-6"> {{ form.password2|as_crispy_field }} </div> <div class="col-12 text-center"> {{ form.captcha|as_crispy_field }} {% for error in form.captcha.errors %} {% if error %} <style> #div_id_captcha { margin-bottom: 0px !important; } </style> <span class="invalid-feedback d-block mb-3"> <strong> You must complete … -
Django : Pass a prefetch_related _set.all() in Ajax Search results
I've implemented a table search product with Ajax and it works well. But now, I want to build dynamically my table taking in account the number of my warehouses can be increase. search.js data.forEach((item) => { const newName = (item.nom).slice(0, 30) + "..."; tableBody.innerHTML += ` <tr> <th><a href="{% url 'product-update' ${item.id} %}">${item.sku}</a></th> <td>${item.etat__etat}</td> <td class="small">${newName}</td> <td>${item.famille__nom}</td> <td>${item.mageid}</td> <td>${item.adresse}</td> models.py (model for witch I need a set) class SstStock(models.Model): warehouse = models.ForeignKey(Warehouse, on_delete=models.CASCADE) product = models.ManyToManyField(Produit) qty = models.IntegerField() last_update = models.DateTimeField(default=timezone.now) views.py def search_product2(request): if request.method == 'POST': search_str = json.loads(request.body).get('searchText') products = Produit.objects.filter(sku__icontains=search_str) | Produit.objects.filter( nom__icontains=search_str) | Produit.objects.filter(mageid__icontains=search_str) data = products.values( 'id', 'sku', 'nom', [...] 'sststock', [...] 'cau_cli', 'maxsst2', ) return JsonResponse(list(data), safe=False) Directly in template I could do : template {% for produit in produits %} {{ produit.sku}}<br> {% for sst in produit.sststock_set.all %} <span>{{sst.warehouse.code}} - {{ sst.qty }}</span><br> {% endfor %} <br> {% endfor %} But I couldn't find the way to pass the the sststock_set.all() in the JsonResponse. I got well a "sststock" value in it but it contains only the last value of the set instead of an array/dict of the whole set. console.log() qty: 7 sku: "ACP863" sststock: 68095 68095 is the last … -
How to insert big HTML block in Javascript? Django JS
I have custom.js file in my django website. I need to create django - div in .js catalog.html <div class="row px-3" id="products-section"> #----------------- # This block should be placed from js #----------------- <div class="col-sm-4"> <article class="post post-medium border-0 pb-0 mb-5"> <div class="post-image"> <a href="{% url 'product' product.url %}"> <img src="media/{{product.img}}" class="img-fluid img-thumbnail img-thumbnail-no-borders rounded-0" alt="" /> </a> </div> <div class="post-content"> <h2 class="font-weight-semibold text-5 line-height-6 mt-3 mb-2"><a href="{% url 'product' product.url_dop %}">{{product.name}}</a></h2> <p>{{product.description}}</p> <div class="post-meta"> <span><i class="far fa-user"></i> by <a href="{% url 'brandpage' product.manufacturer_url %}">{{product.manufacturer_name}}</a> </span> <span class="d-block mt-2"><a href="{% url 'product' product.url %}" class="btn btn-xs btn-light text-1 text-uppercase">Подробнее</a></span> </div> </div> </article> </div> #----------------- # End block #----------------- </div> custom.js var parent_div = document.getElementById("products-section"); var product_node = document.createElement("div"); product_node.className = "col-sm-4"; product_node.innerHTML = "Big html block here"; parent_div.append(product_node); How i can add so big block? And also i need to replace django variables by js variables in this block. -
Advise please with what to build workflow for django
I am trying to build a “workflow” for published Articles. I think this system would work by accept an article journal and coauthors. For example, User create article in form, select journal and coauthors and then the article is saved as "draft". Notification about this article send publisher and coauthors. They decide if the data is entered correctly, if not, then send the article back to the author, and if correct, the article is published on the site. I think there are a lot of apps that do this, but not in one I didn’t find how to do it so that the publisher and co-author could take the job without entering the admin. I would like this to be available through a page on the site (views and template). maybe I’m wrong. I’d love to hear any advice from you -
How do I make custom landing page from admin for my application in django?
How Should I redirect if the admin selected a login page or golive or registration? from django.urls import path from demo import views urlpatterns = [ path('registration', views.home, name='registration'), path('login', views.login, name='login'), path('sessionover', views.over, name='over'), path('golive', views.sessionlive, name='live_session'), path('ques', views.qus_send, name='auestionsent') ] -
Dots (coordinates) on a static map
I would like to display a dots on the static map ( taken from database ) result would look something like: there are latitude and longtitude data in my database for each object that i would like to display. The question is: is this only possible by using some kind of google API? or this could be done in some other way? Maybe somebody seen something similar and would give me a hint where to start? Update: I've gone so far that the only thing is to convert html object to js array. Any idea how to? Html:: {% for c in object_list %} JS:: var flights = {% for c in object_list %} <<--- convert to js.. -
list_filter django with combined fields "A_B"
I want to use the combination of two fields in the django admin (list_filter). Filter by "FieldA_FieldB" A_B A_C Is it possible? How can I do this? Thanks, Davi