0

I want to add css in django-dashing for override all widget.

I tried follow this doc https://django-dashing.readthedocs.io/en/latest/getting-started.html#template-file

But I don't understand : "Also make sure the app which hosts the dashing/dashboard.html template is listed before dashing in INSTALLED_APPS, since you are overriding the default template."
=> I don't have a "hosts", i have just css file...

I create files :

  • dashing/dashboard.html
  • dashing/css/global.css

And I fill dashboard.html :

{% extends 'dashing/base.html' %}
{% load staticfiles %}

{% block stylesheets %}
<link rel="stylesheet" href="{% static 'css/global.css' %}">
{% endblock %}

EDIT And I add my "host" in INSTALLED_APPS (settings.py)

INSTALLED_APPS = (
    'django_dashing', # here
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'dashing',
)```
Eva
  • 23
  • 3

1 Answers1

0

You need to create an app first to use django which would contain the models(dataset structure) views ( how you want to render any html template or what context you need to pass) and other files as per your requirements.

The templates, views, urls and models would be a part of the app which you would create after creating the django project now to add that app to django you need to modify settings.py of the project and add (if your app's name is blog) :

'blog.apps.BlogConfig'

That you need to add in INSTALLED_APPS section of setting.py before every other app so that django while searching for templates renders your templates first instead of the default ones

Amartya Gaur
  • 665
  • 6
  • 21
  • The folder of my app is "django_dashing", but I have already this in INSTALLED_APPS ```INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_dashing', 'dashing', )``` – Eva Jun 13 '19 at 14:26
  • Yes so add the 'django_dashing', line before 'django.contrib.admin', so that the default templates are overridden – Amartya Gaur Jun 13 '19 at 14:30
  • So, I added 'django_dashing' before 'django.contrib.admin' but it don't work :( – Eva Jun 14 '19 at 06:57
  • And I emptied the cache too – Eva Jun 14 '19 at 06:59
  • can you also share your views, urls file contents ? – Amartya Gaur Jun 14 '19 at 08:51
  • for more info, i copy the project to my perso gitlab => https://gitlab.com/ero-my-public-projects/dashing, thanks for your help – Eva Jun 18 '19 at 12:47
  • Your template should not be in static folder, make a folder named Templates in your project root folder then make a folder named django_dasing in it and put your html related to the app inside it. – Amartya Gaur Jun 18 '19 at 12:54
  • well, I have move the files (update on gitlab) but nothing :( – Eva Jun 18 '19 at 13:30