Static files not loading for autocomplete in non-admin
See original GitHub issueTemplate code:
{% load static %}
<DOCTYPE HTML>
<html>
<head>
<title>Create a Course</title>
</head>
<body>
<h1> Register a new course here</h1>
{% if course_registered %}
Rango says: <strong>Thanks</strong>
<a href="/faculty">Return to homepage</a> <br />
{% else %}
<strong>register here</strong>
<form id="course_form" method="post" action="/faculty/create_course/"
enctype="multipart/form-data">
{% csrf_token %}
{{ course_form.as_p }}
<h2>Select Students:</h2>
{{ year_form }}
{{ branch_form }}
<input type="submit" name="submit" value="Register" />
</form>
{% endif %}
</body>
<script type="text/javascript" src="{% static 'admin/js/jquery.js' %}"></script>
<script type="text/javascript" src="{% static 'autocomplete_light/autocomplete.init.js' %}"></script>
<script type="text/javascript" src="{% static 'autocomplete_light/select2.js' %}"></script>
{{ form.media }}
</html>
I have run python manage.py collectstatic and collected my static files in static folder under root directory of my project. Also i have set my static folder in settings.py file.
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
How to use the admin autocomplete field in a custom form?
Instead of adding the static files yourself just add {{form.media}} in html template it will automatically import the required files. – Software ...
Read more >Django test AJAX autocomplete Documentation - Read the Docs
{% load static %}. {% load staticfiles %}. {% block branding %}. <title>Django autocomplete example</title>. {% endblock %}.
Read more >Super Page Cache for Cloudflare – Plugin WordPress
This plugin will help you to cache not only the static files (e.g. CSS, JS, images etc.) but also the HTML webpages generated...
Read more >Quick start — django-autocomplete-light 1.0.26 documentation
staticfiles, then you're on your own to manage staticfiles. This is an example of how you could load the javascript: <script src="http://ajax.googleapis.com/ ...
Read more >3.8.0 :: Hue SQL Assistant Documentation - Hue Guide
Hue HA; Static files caching; Hive 1.1 support; Major upgrade of Django 1.6 ... 3ab7bc5 [spark] Hide and not load Assist if Beeswax...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Does it work when you remove UserForm.Méta.widgets ? The field should deal with the widget by default shouldn’t it ?
Le 8 janv. 2018 20:37, “Bas Van Gaalen” notifications@github.com a écrit :
“I am having problem in loading required static files.”
What’s happening on the network ? Does the Network tab of the firefox or webkit inspector report any error ?
I just spent 12 minutes creating a new project from scratch and the static files all load fine and the autocomplete widget i’ve setup works fine: https://github.com/jpic/rbansalrahul6_project
Create some groups and a user and visit localhost:8000/user/1/
Also, here is the diff, from a fresh django-admin started project, to a working DAL example outside the admin: jpic/rbansalrahul6_project@9b98471 if that is of any help, would you like to complete our tutorial chapter about static files ? In addition to Django’s own documentation about static files, this crash course aiming at incepting the concepts behind static files may help: blog.yourlabs.org/post/30382323418/surviving-djangocontribstaticfiles-or-how-to
Otherwise, please either make a simple demo project either make a better report of what you’re experiencing, here are links which are a must-read and that will definitely help you understand what we need in order to be of any help 😃
http://www.chiark.greenend.org.uk/~sgtatham/bugs.html http://stackoverflow.com/help/how-to-ask