Skip to content

Commit

Permalink
Merge pull request #434 from arthur-wsw/bootstrap3
Browse files Browse the repository at this point in the history
New bootstrap3 default theme + Remove django-crispy-forms and django-floppyforms
  • Loading branch information
galuszkak committed Jun 2, 2016
2 parents f3dc001 + da8b7ad commit 611f44a
Show file tree
Hide file tree
Showing 109 changed files with 3,553 additions and 1,787 deletions.
3 changes: 2 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ History
0.6.2 (?)

* Fix Django 1.8 issues and add 1.9 compatibility
* Update all dependancies (DRF, floppyforms, filters, ...)
* Update django-rest-framework
* Remove django-crispy-forms and django-floppyforms
* Regenerate example project to make it django 1.9 compatible
* Update tox and travis and add flake8
* Rename AdminModel2Mixin to Admin2ModelMixin
Expand Down
75 changes: 54 additions & 21 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,16 @@ Screenshots
Requirements
============

* Django 1.6+
* Django 1.7+
* Python 2.7+ or Python 3.3+
* django-braces_
* django-extra-views_
* django-floppyforms_
* django-rest-framework_
* django-filter_
* Sphinx_ (for documentation)

.. _django-braces: https://github.com/brack3t/django-braces
.. _django-extra-views: https://github.com/AndrewIngram/django-extra-views
.. _django-floppyforms: https://github.com/brutasse/django-floppyforms
.. _django-rest-framework: https://github.com/tomchristie/django-rest-framework
.. _django-filter: https://github.com/alex/django-filter
.. _Sphinx: http://sphinx-doc.org/
Expand All @@ -79,35 +77,36 @@ Add djadmin2 and rest_framework to your settings file:
...
'djadmin2',
'rest_framework', # for the browsable API templates
'floppyforms', # For HTML5 form fields
'crispy_forms', # Required for the default theme's layout
...
)
Add the default theme in your settings file:
Add setting for apps and the default theme in your settings file:

.. code-block:: python
# In settings.py
INSTALLED_APPS += ('djadmin2.themes.djadmin2theme_default',)
ADMIN2_THEME_DIRECTORY = "djadmin2theme_default/"
INSTALLED_APPS += ('djadmin2.themes.djadmin2theme_bootstrap3',)
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 10
}
ADMIN2_THEME_DIRECTORY = "djadmin2theme_bootstrap3"
Add djadmin2 urls to your URLconf:

.. code-block:: python
# urls.py
from django.conf.urls import patterns, include
# urls.py
from django.conf.urls import include
import djadmin2
from djadmin2.site import djadmin2_site
djadmin2.default.autodiscover()
djadmin2_site.autodiscover()
urlpatterns = patterns(
urlpatterns = [
...
url(r'^admin2/', include(djadmin2.default.urls)),
)
]
How to write django-admin2 modules
Expand Down Expand Up @@ -136,6 +135,41 @@ How to write django-admin2 modules
djadmin2.default.register(Comment)
djadmin2.default.register(User, UserAdmin2)
Migrating from 0.6.x
====================

- The default theme has been updated to bootstrap3, be sure to replace your reference to the new one.
- Django rest framework also include multiple pagination system, the only one supported now is the PageNumberPagination.

Therefore, your `settings` need to include this:

.. code-block:: python
# In settings.py
INSTALLED_APPS += ('djadmin2.themes.djadmin2theme_bootstrap3',)
ADMIN2_THEME_DIRECTORY = "djadmin2theme_bootstrap3"
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 10
}
The default admin2 site has move into djadmin2.site make sure your use the news djadmin2_site in your urls.py:

.. code-block:: python
# urls.py
from django.conf.urls import include
from djadmin2.site import djadmin2_site
djadmin2_site.autodiscover()
urlpatterns = [
...
url(r'^admin2/', include(djadmin2.default.urls)),
]
Migrating from 0.5.x
====================

Expand All @@ -145,8 +179,7 @@ Themes are now defined explicitly, including the default theme. Therefore, your
# In settings.py
INSTALLED_APPS += ('djadmin2.themes.djadmin2theme_default',)
ADMIN2_THEME_DIRECTORY = "djadmin2theme_default/"
ADMIN2_THEME_DIRECTORY = "djadmin2theme_default"
Drop-In Themes
==============
Expand All @@ -156,8 +189,8 @@ The default theme is whatever bootstrap is most current. Specifically:
.. code-block:: python
# In settings.py
INSTALLED_APPS += ('djadmin2.themes.djadmin2theme_default',)
ADMIN2_THEME_DIRECTORY = "djadmin2theme_default/"
INSTALLED_APPS += ('djadmin2.themes.djadmin2theme_bootstrap3',)
ADMIN2_THEME_DIRECTORY = "djadmin2theme_bootstrap3"
If you create a new theme, you define it thus:

Expand All @@ -166,7 +199,7 @@ If you create a new theme, you define it thus:
# In settings.py
# Mythical theme! This does not exit... YET!
INSTALLED_APPS += ('djadmin2theme_foundation',)
ADMIN2_THEME_DIRECTORY = "djadmin2theme_foundation/"
ADMIN2_THEME_DIRECTORY = "djadmin2theme_foundation"
Follows Best Practices
======================
Expand Down

0 comments on commit 611f44a

Please sign in to comment.