Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How o assign date to Datefield in flask
I have a scenario where I will have to assign date returned from Database to my DateField in flask UI application. I am trying to assign the date but its removing my DateField/Calendar from UI and hence user not able to change/select differen date from Calendar. Can you please tell me correct way to do that? Code: Form Code: class GetDate(FlaskForm) : my_date = DateField('Date of Birth') @ap.route('/customerinfo', methods=''GET','POST']) def customer_data: dob=dbcall.selectsql('my sql query') customer_data=GetDate() customer_data.dob = dob return render_template('/customerinfo.html', customer_data=customer_data) Html Code: {{customer_data.dob.label }} {{customer_data.dob}} -
Django rest framework return validation error messages from endpoints
Using Django==3.0.8 djangorestframework==3.11.0 I am trying to validate a GET endpoint which looks like this. /users?role=Prospect&limit=10&offset=0 How can we validate this request in DRF using serializers.Serializer and get all the validation error messages when invalid and return in api response? Serializer using for this request: class UserIndexSerializer(serializers.Serializer): offset = serializers.IntegerField(required=True) limit = serializers.IntegerField(required=True) role = serializers.CharField(allow_null=True, default=None, max_length=255) View looks function looks like: @api_view(["GET"]) def user_list(request): serializer = UserIndexSerializer(data=request.data) // trying to validate using this serializer print("query params", request.GET) print("request valid", serializer.is_valid()) users = User.objects.all() serializer = UserGetSerializer(users, many=True) return AppResponse.success("User list found.", serializer.data) -
How to Use annotate function to in django for below condition?
class Surface(models.Model): name = models.CharField(max_length=100) class SurfaceGeometry(models.Model): surface = models.ForeignKey(Surface, on_delete=models.DO_NOTHING) geometry_parameter = models.ForeignKey(SurfaceGeometryParameters, on_delete=models.CASCADE) value = models.FloatField() class SurfaceGeometryParameters(models.Model): name = models.CharField(max_length=30, unique=True) Surface.objects.prefetch_related('surface_class',Prefetch('surfacecorrelationcontroller_set'),Prefetch('surfacegeometry_set')).annotate(height=?).order_by('surface_class__name','-height') I want to take height(value) from SurfaceGeomentry model where Height is name of geometry parameter from SurfaceGeometryParameters models for Surface. I can get a height from SurfaceGeometry like this. SurfaceGeometry.objects.get(surface__id = 1, geometry_parameter__name__iexact= 'Height') where surfcace__id's value 1 should come from parent query. How I can achieve the this? -
wagtail-menus is loading the menu but not my page links
It was working before I deleted and recreated my database, I have no idea why it's no longer working, I've ensured that show in menus is checked under the promote panel. base.html {% load static wagtailuserbar %} {% load wagtailcore_tags %} {% load menu_tags %} <!DOCTYPE html> <html class="no-js" lang="en" content="text/html"> <head> <meta charset="utf-8" /> <title> {% block title %} {% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %} {% endblock %} {% block title_suffix %} {% with self.get_site.site_name as site_name %} {% if site_name %}- {{ site_name }}{% endif %} {% endwith %} {% endblock %} </title> <meta name="description" content="text/html" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> {% block extra_css %} {# Override this in templates to add extra stylesheets #} {% endblock %} {% load static wagtailsettings_tags %} {% get_settings %} <body class="{% block body_class %}{% endblock %}"> {% main_menu max_levels=2 add_sub_menus_inline=True %} templates/menus/main/menu.html {% load menu_tags %} <nav class="navbar fixed-top navbar-dark navbar-expand-lg navbar-lg" role="navigation"> <div class="container"> <a class="navbar-brand" href="/">Title</a> <button type="button" class="navbar-toggler text-white" data-toggle="collapse" data-target="#navbar-collapse-01"> <i class="fas fa-bars fa-1x"></i> </button> <div class="collapse navbar-collapse" id="navbar-collapse-01"> <ul class="nav navbar-nav ml-auto text-white"> {% for item in menu_items %} {% if item.sub_menu %} <li class="nav-item dropdown {{item.active_class}}"><a class="nav-link dropdown-toggle" … -
Is it possible to create separate customer auth_user for two different Django projects in same database?
Say Project-1 and Project-2 are using same database. Both the Project-1 and the Project-2 planing to have separate custom user model. For example db_table=p1_user for Project-1 and db_table=p2_user for Project-2. Dose Django actually allow to do this customization? Or How to achieve it? -
Django Admin: Custom User model in app section instead of auth section
As in question 36046698, I have a CustomUser model defined in models.py. I would like it to appear in the Authentication & Authorization section in Django Admin. I tried adding app_label = 'auth' as suggested, i.e. class CustomUser(AbstractUser): class Meta: app_label = 'auth' When I do that, my app won’t start, and errors out like so: Traceback (most recent call last): File "/Users/paul/myapp/.direnv/python-3.8.5/lib/python3.8/site-packages/django/apps/config.py", line 178, in get_model return self.models[model_name.lower()] KeyError: 'customuser' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/paul/myapp/.direnv/python-3.8.5/lib/python3.8/site-packages/django/contrib/auth/__init__.py", line 157, in get_user_model return django_apps.get_model(settings.AUTH_USER_MODEL, require_ready=False) File "/Users/paul/myapp/.direnv/python-3.8.5/lib/python3.8/site-packages/django/apps/registry.py", line 211, in get_model return app_config.get_model(model_name, require_ready=require_ready) File "/Users/paul/myapp/.direnv/python-3.8.5/lib/python3.8/site-packages/django/apps/config.py", line 180, in get_model raise LookupError( LookupError: App 'myapp' doesn't have a 'CustomUser' model. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "/Users/paul/myapp/.direnv/python-3.8.5/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line .... File "/Users/paul/myapp/myapp/admin.py", line 3, in <module> from django.contrib.auth.admin import UserAdmin File "/Users/paul/myapp/.direnv/python-3.8.5/lib/python3.8/site-packages/django/contrib/auth/admin.py", line 6, in <module> from django.contrib.auth.forms import ( File "/Users/paul/myapp/.direnv/python-3.8.5/lib/python3.8/site-packages/django/contrib/auth/forms.py", line 21, in <module> UserModel = get_user_model() File "/Users/paul/myapp/.direnv/python-3.8.5/lib/python3.8/site-packages/django/contrib/auth/__init__.py", line 161, in get_user_model raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'myapp.CustomUser' that has not … -
Using Router vs including url in urlpatterns
Say I am creating a Todo app in Django, traditionally I would include a path to my app in the base_project urls.py file. However, today I came across a tutorial where they used a router for this same purpose I've already stated. Why would I want to use a Router instead of including the path in my urls.py file? For reference, here is a snip from the tutorial found at https://www.digitalocean.com/community/tutorials/build-a-to-do-application-using-django-and-react # backend/urls.py from django.contrib import admin from django.urls import path, include # add this from rest_framework import routers # add this from todo import views # add this router = routers.DefaultRouter() # add this router.register(r'todos', views.TodoView, 'todo') # add this urlpatterns = [ path('admin/', admin.site.urls), path('api/', include(router.urls)) # add this ] Here backend is the main django project name. -
Running Django with Gunicorn over Nginx in Kubernetes is a good idea?
I created Django site and I expecting a lot of processing on my site. I'm running Nginx server with Gunicorn as explained in this tutorial I would like to make something scalable to be able to raise processing power on my site. I have a simple question. Is it possible to move this severs-lump into kubernetes? And if yes, is it a good idea? Or should I use nginx with uWSGI ? -
Django F() expression not working inside a function parameter
I'm trying to convert DateTime value with a specific timezone in a query, it worked when I explicitly added the timezone InventoryDetails.objects.filter(Q(check_time=checktime.astimezone(timezone('Asia/Kolkata'))) But it's not working when I use the below F() expression InventoryDetails.objects.filter(Q(check_time=checktime.astimezone(timezone(F('time_zone'))) -
Django Polls App: Background Image Not Loading
I am learning Django and building out the first test poll app but am running into issues with the background images. The green text works, but adding the background image does not do anything (background is just white). Any idea why this is not functioning properly? Background Image C:\Users\xxx\Python\Django\mysite\polls\static\polls\images\sample123.jpg Style CSS: C:\Users\xxx\Python\Django\mysite\polls\static\polls\style.css li a { color: green; } h1 { color: red; } body { background: white url("images/sample123.jpg") no-repeat; } Index HTML: C:\Users\xxxx\Python\Django\mysite\polls\templates\polls {% load static %} <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}"> {% if latest_question_list %} <ul> {% for question in latest_question_list %} <li><a href="{% url 'polls:detail' question.id %}">{{ question.question_text }}</a></li> {% endfor %} </ul> {% else %} <p>No polls are available.</p> {% endif %} -
UpdateView and Preventing Users from Editing Other Users' Content
I'm using the UpdateView class to allow users to update their content in my app. I am now trying to figure out how to allow users to only edit their own content (and not other users' content). Appreciate any help. class OrganismUpdate(UpdateView): model = Organism fields = ['name', 'edibility', 'ecosystem', 'weather', 'date', 'location'] template_name_suffix = '_update_form' success_url ="/organism_images" -
Trying to access 'content_object' fields in Django under ContentType
I am trying to access the Item model through the Thing queryset, and keep getting the error: django.core.exceptions.FieldError: Field 'content_object' does not generate an automatic reverse relation and therefore cannot be used for reverse querying. If it is a GenericForeignKey, consider adding a GenericRelation. class ThingContent(models.Model): content_id = models.AutoField(primary_key=True, null=False) thing = models.ForeignKey('Thing', on_delete=models.SET_NULL, null=True) content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) object_id = models.PositiveIntegerField() content_object = GenericForeignKey('content_type', 'object_id') I have tried updating the fields on Item by adding a related_query_name to no success. self.queryset.filter(content_object__item_date=exact_item_date)) -
How to show 3 Cards in a Row in Bootstrap Grid System
I am trying to add 3 cards in a row using bootstrap grid system but the problem is that when I use Django loop each card is showing on its own in each row which is not what I want. I have searched for the answer and I have added it to show my trial but it did not work. Here is the template.html before adding django loop <div class="row row-cols-1 row-cols-md-3 g-4"> <div class="col"> <div class="card h-100"> <img src="" class="card-img-top" alt="..." /> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text"> This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer. </p> </div> <div class="card-footer"> <small class="text-muted">Last updated 3 mins ago</small> </div> </div> </div> <div class="col"> <div class="card h-100"> <img src="" class="card-img-top" alt="..." /> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text"> This card has supporting text below as a natural lead-in to additional content. </p> </div> <div class="card-footer"> <small class="text-muted">Last updated 3 mins ago</small> </div> </div> </div> <div class="col"> <div class="card h-100"> <img src="" class="card-img-top" alt="..." /> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text"> This is a wider card with supporting text below as a natural lead-in to … -
Collecting static in Django - Gunicorn wont find the directory
I have settings.py in my /home/suomi/mediadbin/mediadbin directory with settings BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_URL = '/static/' I've used python manage.py collectstatic so my static files are in /home/suomi/mediadbin/static In the directory with manage.py (/home/suomi/mediadbin/) I run gunicorn like this gunicorn mediadbin.wsgi:application --bind 0.0.0.0:8000 when I access my site it shows Not Found: /static/main_app/main.css I also tried STATIC_URL = os.path.join(BASE_DIR, 'static') what I'm doing wrong?? -
Django how to send_mail via local sendmail
I would like to send out email via local sendmail. my email settings in settings.py is below EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'localhost' EMAIL_PORT = 25 EMAIL_HOST_USER = '' EMAIL_HOST_PASSWORD = '' EMAIL_USE_TLS = False DEFAULT_FROM_EMAIL = 'default_from_email@email.com' the error is [Errno 61] Connection refused -
Multiple apps in git remote and how to specify to one app
I was working with another developer on my git repository and he pushed his work to me after forking. When I wanted to deploy the change of our work to Heroku, with git push Heroku master I get the following error. Previously it was always working when I deploy. I need to specify the app, but don't know how. I am using Django and VScode. This is the following error: Error: Multiple apps in git remotes › Usage: --remote heroku-staging › or: --app radiant-escarpment-03215 › Your local git repository has more than 1 app referenced in git remotes. › Because of this, we can't determine which app you want to run this command against. › Specify the app you want with --app or --remote. › Heroku remotes in repo: › beneluxbilal (heroku) › radiant-escarpment-03215 (heroku-staging) I already tried with --app but it seems not to work for me. -
Django set default empty url
I'm trying to learn Django and I'm following Corey Shafer's tutorials (https://www.youtube.com/watch?v=a48xeeo5Vnk), but when I try to make two different pages, I get automatically directed to the one with an "empty address": In his: /Blog /urls.py it looks like this: from django.conf.urls import path from . import views urlpatterns = [ path('', views.home, name='blog-home'), path('about/', views.about, name='blog-about'), ] and when he goes to localhost:8000/blog/about, the page displays correctly When I try to imitate his code for blog/urls.py: from django.conf.urls import url from . import views urlpatterns = [ url(r'', views.home, name='blog-home'), url(r'^about/', views.about, name='blog-about'), ] the result of the localhost:8000/blog/about is the content of views.home, and not views.about. The following works correctly, when I write a name instead of an empty string: urlpatterns = [ url(r'^home', views.home, name='blog-home'), url(r'^about/', views.about, name='blog-about'), ] But I don't understand why it worked in a previous version, why it won't work now, and what could fix it -
Can I register a setting with a default value then use that setting in a model's field?
Is there any way I can @register_setting a setting with a default value, then use that setting in the default value for a field? I'd like my users to be able to specify a global tax rate default, but change it per location as needed. I'm already using a setting in another function on the same model, but believe the issue might be that it's not within a function in this case. I tried specifying default=8.25 in the constructor for default_sales_tax_rate, but that doesn't seem to work. I am getting a NameError: name 'DefaultSalesTaxRate' is not defined error. @register_setting class DefaultSalesTaxRate(BaseSetting): default_sales_tax_rate = models.DecimalField( max_digits=4, decimal_places=2, help_text="Default Sales Tax Rate", default=8.25 ) locations.models.LocationPage(Page) location_sales_tax_rate = models.DecimalField(max_digits=4, decimal_places=2, default=DefaultSalesTaxRate.objects.first().default_sales_tax_rate) I've tried assigning a variable sales_default to 8.25 if DefaultSalesTaxRate.objects.all().count() == 0, but that didn't work either. I am thinking maybe a hook or a signal to instantiate the setting in the table if it's not present, but am not sure where to hook into or where to call the signal. -
Django Staticfiles Is Saved In An Unexpected Location
I followed the documentation at Django 2.2 Static Setup 2: https://docs.djangoproject.com/en/2.2/howto/static-files/ but to my surprise, anytime I run manage.py collectstatic it keeps storing the static files in the C:/ not inside the project static folder. The image below explains further what I am saying The settings of static file -
React Native 401 Unauthorized Error From DRF
My restful api (Django Rest API) on heroku works fine locally. It's currently deployed on heroku. I'm using react native app to interact with the API. Each time i try retrieving the details of authenticated user, first the details is returned just after that it throws 401 error.... The flow of my application is After successful authentication Save user's token Retrieve authenticated user's details Authentication passes fine (authenticated user's details is also outputted on the log) but the bit of getting user's details fails with 401 unauthorized Here is my server log on heroku 2020-12-21T22:33:45.106941+00:00 app[web.1]: 10.43.233.181 - - [21/Dec/2020:22:33:45 +0000] "POST /api/accounts/token/ HTTP/1.1" 200 441 "-" "jisee/1 CFNetwork/1206 Darwin/20.1.0" 2020-12-21T22:33:45.232882+00:00 heroku[router]: at=info method=PUT path="/api/accounts/token/device/" host=webapp.herokuapp.com request_id=4a5a06f9-ec50-4ecb-879e-20805784ba5c fwd="86.182.91.70" dyno=web.1 connect=0ms service=15ms status=200 bytes=255 protocol=https 2020-12-21T22:33:45.106757+00:00 heroku[router]: at=info method=POST path="/api/accounts/token/" host=webapp.herokuapp.com request_id=a4b7e5f6-1333-4b82-b180-12850391c382 fwd="86.182.91.70" dyno=web.1 connect=1ms service=399ms status=200 bytes=724 protocol=https 2020-12-21T22:33:45.232905+00:00 app[web.1]: 10.43.233.181 - - [21/Dec/2020:22:33:45 +0000] "PUT /api/accounts/token/device/ HTTP/1.1" 200 0 "-" "jisee/1 CFNetwork/1206 Darwin/20.1.0" 2020-12-21T22:33:45.368821+00:00 app[web.1]: Unauthorized: /api/users/details/ 2020-12-21T22:33:45.369671+00:00 app[web.1]: 10.43.233.181 - - [21/Dec/2020:22:33:45 +0000] "GET /api/users/details/ HTTP/1.1" 401 58 "-" "jisee/1 CFNetwork/1206 Darwin/20.1.0" 2020-12-21T22:33:45.369458+00:00 heroku[router]: at=info method=GET path="/api/users/details/" host=webapp.herokuapp.com request_id=1de46c11-fa6d-4ebd-984e-40191239f031 fwd="86.182.91.70" dyno=web.1 connect=0ms service=5ms status=401 bytes=393 protocol=https NOTICE THIS BIT HERE ( Which shows that the user is authorized … -
Django ajax post method dont redirect
im following a tuto on how ajax work on Django, its my first time with ajax and im facing a little problem ,the data insertion is working but the success ajax dont redirect corectly, and thank you for the help this the code views.py : class exo(View): def get(self, request): form = ExerciseForm() tasks = task.objects.all() context = { 'form': form, 'tasks': tasks } return render(request, 'coach/test.html', context=context) def post(self, request): form = ExerciseForm() if request.method == 'POST': form = ExerciseForm(request.POST) print(form) if form.is_valid(): print('adding task', form) new_exrercise = form.save() return JsonResponse({'task': model_to_dict(new_exrercise)}, status=200 ) else: print('not adding task') return redirect('exo') ajax function : $(document).ready(function(){ $("#addExercise").click(function() { var serializedData = $("#TaskForm").serialize(); $.ajax({ url: $("TaskForm").data('url'), data : serializedData, type: 'post', success: function(response) { $("#taskList").append('<div class="card"><div class="card-body">'+ response.task.name +'<button type="button" class="close float-right"> <span aria-hidden="true">&times;</span></button></div></div>'); } }) }); }); html content : <form class="submit-form" method="post" id="TaskForm" data-url="{% url 'session' %}"> {% csrf_token %} <div class="form-group"> {% for field in form %} <div style="margin-bottom: 2rem;"></div> {{field}} {% endfor %} <div style="margin-bottom: 2rem;"></div> <button type="submit" class="btn btn-success dropdown-toggle " id="addExercise">Confirm</button> </div> </form> this is what i get (i get an object and nothing else ) output image when i comeback to the page exo the … -
How to set a field equal to a related model's foreign key on save() Django
I have three models, LocationPage, Customer, and WorkOrder. LocationPage has a city_name CharField. Customer and WorkOrder both have a customer_city and service_city ForeignKey to LocationPage, respectively. On creation of a WorkOrder when service_city is left blank I want to update service_city with the same ForeignKey as belongs to Customer's customer_city. However, when I try this, I get an OperationalError at /admin/workorders/workorder/create/ table workorders_workorder has no column named service_city_id locations.models.LocationPage class LocationPage(Page): """Location page model.""" location_city = models.CharField(max_length=100, blank=False, null=False) class Meta: verbose_name = "Location Page" verbose_name_plural = "Location Pages" def get_context(self, request): context = super().get_context(request) return context workorders.models.Customer class Customer(index.Indexed, ClusterableModel, models.Model): customer_city = models.ForeignKey('locations.LocationPage', on_delete=models.PROTECT, verbose_name="City", related_name="cust_city") referred_from = models.CharField(max_length=1, choices=REFERRAL_CHOICES, default='g') created = models.DateTimeField(editable=False, default=timezone.now()) modified = models.DateTimeField(null=True) class Meta: verbose_name = "Customer" verbose_name_plural = "Customers" def get_context(self, request): context = super().get_context(request) return context def save(self, *args, **kwargs): if not self.id: self.created = timezone.now() self.modified = timezone.now() return super(Customer, self).save(*args, **kwargs) workorders.models.WorkOrder class WorkOrder(index.Indexed, ClusterableModel, models.Model): """Workorder model.""" same_as_customer_address = models.BooleanField(blank=True, default=False, verbose_name="Same as Customer") service_city = models.ForeignKey('locations.LocationPage', on_delete=models.PROTECT, help_text="Dallas", verbose_name="City", blank=True, null=False) related_customer = ParentalKey('Customer', related_name='workorders', on_delete=models.CASCADE, null=False, verbose_name="Customer") def save(self, *args, **kwargs): if self.same_as_customer_address: self.service_address = self.related_customer.customer_address self.service_city = self.related_customer.customer_city self.service_state = self.related_customer.customer_state self.service_zip = self.related_customer.customer_zip … -
How to create bitmap indexes in Django
What is the canonical way of creating bitmap indexes for in Django? Customized migration using RunSQL opeartion? How to maintain the indexes afterwards also raw queries? class Migration(migrations.Migration): dependencies = [ # Dependencies to other migrations ] operations = [ migrations.RunSQL( sql="CREATE BITMAP INDEX name ON table (column);" reverse_sql = ... ), ] -
Cloning a Django project has now meant that my CSS file isn't being found
I have been writing a project for a course I am doing but unfortunately the IDE I was using ran out of space and I had to start afresh by cloning my project to a new environment. My old environment had a CSS file that was being picked up correctly. When I cloned the project an extra base directory was created and now I have noticed that my CSS file isn't being picked up. I don't get any errors, but nothing in my CSS is being used. I assume that since it used to work it should be fairly simple to sort out but I cannot see what the problem is. If anyone has any ideas it would be greatly appreciated. This is my header in base.html: <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>IssueTracker{% block page_title %}{% endblock %}</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> <link rel="stylesheet" href="{% static 'css/styles.css' %}"> <script src="https://kit.fontawesome.com/c46cd61739.js" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> {% block head_js %} <script type="text/javascript" src="https://js.stripe.com/v2/"></script> <script type="text/javascript"> //<![CDATA[ Stripe.publishableKey = '{{ publishable }}'; //]]> </script> <script type="text/javascript" src="{% static 'js/stripe.js' %}"></script> {% endblock %} </head> This is the … -
Django Smart Select JQuery Conflict
I am trying to use Django smart selects as part of my website development. I first noticed that when the field, the Smart select field was working as it should in the form however it was conflicting with my jQuery templates. I tried to add a line in settings.py JQUERY_URL = False However when I added this setting the template worked correctly however the smart select field was coming blank The Jquery I'm using in my templates is: https://code.jquery.com/jquery-3.2.1.slim.min.js I am quite new to web development and therefore need help in determining what needs to be done here. Thanks