diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-05 07:31:28 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 07:31:28 +0000 |
commit | 612cb44363471c01dde42662137280d1f7891b1b (patch) | |
tree | f96f8de30ccb1380c281d76fb72d89ce0f313d10 | |
parent | 2571638b29fac97808af8a76c5629a49634f4abc (diff) |
automatic import of python-django-tabbed-adminopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-django-tabbed-admin.spec | 705 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 707 insertions, 0 deletions
@@ -0,0 +1 @@ +/django-tabbed-admin-1.0.4.tar.gz diff --git a/python-django-tabbed-admin.spec b/python-django-tabbed-admin.spec new file mode 100644 index 0000000..561608b --- /dev/null +++ b/python-django-tabbed-admin.spec @@ -0,0 +1,705 @@ +%global _empty_manifest_terminate_build 0 +Name: python-django-tabbed-admin +Version: 1.0.4 +Release: 1 +Summary: Easily add tabs to django admin forms. +License: BSD License +URL: http://www.revsquare.com +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f0/1a/e23ecbbf8e89373958cac8eb86aa95fdfda86e47c0fef877a65f58ab7ac7/django-tabbed-admin-1.0.4.tar.gz +BuildArch: noarch + + +%description +.. image:: https://badge.fury.io/py/django-tabbed-admin.png + :target: http://badge.fury.io/py/django-tabbed-admin + :alt: PyPI version + :height: 18px + +.. image:: https://travis-ci.org/omji/django-tabbed-admin.png?branch=master + :target: https://travis-ci.org/omji/django-tabbed-admin + :alt: build-status + :height: 18px + +.. image:: https://coveralls.io/repos/omji/django-tabbed-admin/badge.png?branch=master + :target: https://coveralls.io/r/omji/django-tabbed-admin + :alt: coverage + :height: 18px + +################### +Django tabbed admin +################### + +Simple library to easilly add tabs to admin forms. It also allows users to re-order inlines and fieldsets. +Django tabbed admin is compatible with django-grappelli and django-gipsy. + +.. image:: https://box.everhelper.me/attachment/256054/rSqCFM20d245qFlG5z64EgiOVpeuTU3P/341506-h1u4JrpaUan0tG2e/screen.png + :height: 400px + :width: 800 px + +Grappelli: + +.. image:: https://box.everhelper.me/attachment/256057/rSqCFM20d245qFlG5z64EgiOVpeuTU3P/341506-kQnZXKsO0pfrU4cI/screen.png + :height: 400px + :width: 800 px + +******* +Install +******* + +It is strongly recommanded to install this theme from GIT with PIP onto you project virtualenv. + +From PyPi + +.. code-block:: shell-session + + pip install django-tabbed-admin + +From Github + +.. code-block:: shell-session + + https://github.com/omji/django-tabbed-admin#egg=tabbed_admin + + +***** +setup +***** + +Simply add the app in your installed apps list in settings.py + +.. code-block:: python + + INSTALLED_APPS = ( + ... + 'tabbed_admin' + ... + ) + +Django-tabbed-admin by default requires Jquery UI tabs plugin in order to work. It is packaged with the static files required to make it funcitonnal, however, they are not activated by default to avoid a conflict with other libraries. + +In order to activate the Jquery UI statics, add the following line to the project settings: + +.. code-block:: python + + TABBED_ADMIN_USE_JQUERY_UI = True + + +******************** +Configure admin tabs +******************** + +In order to add tabs to a model admin, it should inherit from tabbed_admin.TabbedModelAdmin and contain a tabs attribute. +The tab attribute configuration tries to remain similar to the fieldsets and inlines setup logic. + +Basically, a tuple can be created for each tab exactely the same way as for fieldsets, except that inlines can be added anywhere in between. + +.. code-block:: python + + tab_overview = ( + (None, { + 'fields': ('name', 'bio', 'style') + }), + MusicianInline, + ('Contact', { + 'fields': ('agent', 'phone', 'email') + }) + ) + +Then each tuple have to be passed to a *tabs* attribute prefixed by the verbose name to display within the tab: + +.. code-block:: python + + tabs = [ + ('Overview', tab_overview), + ('Albums', tab_album) + ] + + +A full example would give: + +.. code-block:: python + + from django.contrib import admin + + from tabbed_admin import TabbedModelAdmin + from .models import Band, Musician, Album + + + class MusicianInline(admin.StackedInline): + model = Musician + extra = 1 + + + class AlbumInline(admin.TabularInline): + model = Album + extra = 1 + + + @admin.register(Band) + class BandAdmin(TabbedModelAdmin): + model = Band + + tab_overview = ( + (None, { + 'fields': ('name', 'bio', 'style') + }), + MusicianInline, + ('Contact', { + 'fields': ('agent', 'phone', 'email') + }) + ) + tab_album = ( + AlbumInline, + ) + tabs = [ + ('Overview', tab_overview), + ('Albums', tab_album) + ] + +************************** +Configure tabs dynamically +************************** + +Be warned that the tabs will completely reset the fieldsets and inlines attributes in order to avoid conflicts during the form saving. Both attributes are overwritten with the entries passed to the tabs attribute. For the same reasons, it is highly recommanded not to overwrite get_fieldsets or get_inlines. + +You can pass and modify the tabs dynamically the same way you would do for fieldsets or inlines. + +.. code-block:: python + + def get_tabs(self, request, obj=None): + tabs = self.tabs + if obj is not None: + tab_overview = self.tab_overview + ('Social', { + 'fields': ('website', 'twitter', 'facebook') + }) + tab_ressources = self.tab_ressources + (InterviewInline, ) + tabs = [ + ('Overview', tab_overview), + ('Ressources', tab_ressources) + ] + self.tabs = tabs + return super(BandAdmin, self).get_tabs(request, obj) + + +******************** +Change the jquery ui +******************** + +You can change the jquery ui css and js by either overriding the media in the +admin class + +.. code-block:: python + + class Media: + css = { + 'all': ('css/jquery-ui.theme.min.css',) + } + +or by changing the the following settings, + +`TABBED_ADMIN_JQUERY_UI_CSS` and `TABBED_ADMIN_JQUERY_UI_JS` + +.. code-block:: python + + TABBED_ADMIN_JQUERY_UI_CSS = 'static/css/my-custom-jquery-ui.css' + TABBED_ADMIN_JQUERY_UI_JS = 'static/js/my-custom-jquery-ui.js' + + +Contribution +************ + +Please feel free to contribute. Any help and advices are much appreciated. +You will find an example application to run and develop the library easily. + + +***** +LINKS +***** + +Development: + https://github.com/omji/django-tabbed-admin + +Package: + https://pypi.python.org/pypi/django-tabbed-admin + + +%package -n python3-django-tabbed-admin +Summary: Easily add tabs to django admin forms. +Provides: python-django-tabbed-admin +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-django-tabbed-admin +.. image:: https://badge.fury.io/py/django-tabbed-admin.png + :target: http://badge.fury.io/py/django-tabbed-admin + :alt: PyPI version + :height: 18px + +.. image:: https://travis-ci.org/omji/django-tabbed-admin.png?branch=master + :target: https://travis-ci.org/omji/django-tabbed-admin + :alt: build-status + :height: 18px + +.. image:: https://coveralls.io/repos/omji/django-tabbed-admin/badge.png?branch=master + :target: https://coveralls.io/r/omji/django-tabbed-admin + :alt: coverage + :height: 18px + +################### +Django tabbed admin +################### + +Simple library to easilly add tabs to admin forms. It also allows users to re-order inlines and fieldsets. +Django tabbed admin is compatible with django-grappelli and django-gipsy. + +.. image:: https://box.everhelper.me/attachment/256054/rSqCFM20d245qFlG5z64EgiOVpeuTU3P/341506-h1u4JrpaUan0tG2e/screen.png + :height: 400px + :width: 800 px + +Grappelli: + +.. image:: https://box.everhelper.me/attachment/256057/rSqCFM20d245qFlG5z64EgiOVpeuTU3P/341506-kQnZXKsO0pfrU4cI/screen.png + :height: 400px + :width: 800 px + +******* +Install +******* + +It is strongly recommanded to install this theme from GIT with PIP onto you project virtualenv. + +From PyPi + +.. code-block:: shell-session + + pip install django-tabbed-admin + +From Github + +.. code-block:: shell-session + + https://github.com/omji/django-tabbed-admin#egg=tabbed_admin + + +***** +setup +***** + +Simply add the app in your installed apps list in settings.py + +.. code-block:: python + + INSTALLED_APPS = ( + ... + 'tabbed_admin' + ... + ) + +Django-tabbed-admin by default requires Jquery UI tabs plugin in order to work. It is packaged with the static files required to make it funcitonnal, however, they are not activated by default to avoid a conflict with other libraries. + +In order to activate the Jquery UI statics, add the following line to the project settings: + +.. code-block:: python + + TABBED_ADMIN_USE_JQUERY_UI = True + + +******************** +Configure admin tabs +******************** + +In order to add tabs to a model admin, it should inherit from tabbed_admin.TabbedModelAdmin and contain a tabs attribute. +The tab attribute configuration tries to remain similar to the fieldsets and inlines setup logic. + +Basically, a tuple can be created for each tab exactely the same way as for fieldsets, except that inlines can be added anywhere in between. + +.. code-block:: python + + tab_overview = ( + (None, { + 'fields': ('name', 'bio', 'style') + }), + MusicianInline, + ('Contact', { + 'fields': ('agent', 'phone', 'email') + }) + ) + +Then each tuple have to be passed to a *tabs* attribute prefixed by the verbose name to display within the tab: + +.. code-block:: python + + tabs = [ + ('Overview', tab_overview), + ('Albums', tab_album) + ] + + +A full example would give: + +.. code-block:: python + + from django.contrib import admin + + from tabbed_admin import TabbedModelAdmin + from .models import Band, Musician, Album + + + class MusicianInline(admin.StackedInline): + model = Musician + extra = 1 + + + class AlbumInline(admin.TabularInline): + model = Album + extra = 1 + + + @admin.register(Band) + class BandAdmin(TabbedModelAdmin): + model = Band + + tab_overview = ( + (None, { + 'fields': ('name', 'bio', 'style') + }), + MusicianInline, + ('Contact', { + 'fields': ('agent', 'phone', 'email') + }) + ) + tab_album = ( + AlbumInline, + ) + tabs = [ + ('Overview', tab_overview), + ('Albums', tab_album) + ] + +************************** +Configure tabs dynamically +************************** + +Be warned that the tabs will completely reset the fieldsets and inlines attributes in order to avoid conflicts during the form saving. Both attributes are overwritten with the entries passed to the tabs attribute. For the same reasons, it is highly recommanded not to overwrite get_fieldsets or get_inlines. + +You can pass and modify the tabs dynamically the same way you would do for fieldsets or inlines. + +.. code-block:: python + + def get_tabs(self, request, obj=None): + tabs = self.tabs + if obj is not None: + tab_overview = self.tab_overview + ('Social', { + 'fields': ('website', 'twitter', 'facebook') + }) + tab_ressources = self.tab_ressources + (InterviewInline, ) + tabs = [ + ('Overview', tab_overview), + ('Ressources', tab_ressources) + ] + self.tabs = tabs + return super(BandAdmin, self).get_tabs(request, obj) + + +******************** +Change the jquery ui +******************** + +You can change the jquery ui css and js by either overriding the media in the +admin class + +.. code-block:: python + + class Media: + css = { + 'all': ('css/jquery-ui.theme.min.css',) + } + +or by changing the the following settings, + +`TABBED_ADMIN_JQUERY_UI_CSS` and `TABBED_ADMIN_JQUERY_UI_JS` + +.. code-block:: python + + TABBED_ADMIN_JQUERY_UI_CSS = 'static/css/my-custom-jquery-ui.css' + TABBED_ADMIN_JQUERY_UI_JS = 'static/js/my-custom-jquery-ui.js' + + +Contribution +************ + +Please feel free to contribute. Any help and advices are much appreciated. +You will find an example application to run and develop the library easily. + + +***** +LINKS +***** + +Development: + https://github.com/omji/django-tabbed-admin + +Package: + https://pypi.python.org/pypi/django-tabbed-admin + + +%package help +Summary: Development documents and examples for django-tabbed-admin +Provides: python3-django-tabbed-admin-doc +%description help +.. image:: https://badge.fury.io/py/django-tabbed-admin.png + :target: http://badge.fury.io/py/django-tabbed-admin + :alt: PyPI version + :height: 18px + +.. image:: https://travis-ci.org/omji/django-tabbed-admin.png?branch=master + :target: https://travis-ci.org/omji/django-tabbed-admin + :alt: build-status + :height: 18px + +.. image:: https://coveralls.io/repos/omji/django-tabbed-admin/badge.png?branch=master + :target: https://coveralls.io/r/omji/django-tabbed-admin + :alt: coverage + :height: 18px + +################### +Django tabbed admin +################### + +Simple library to easilly add tabs to admin forms. It also allows users to re-order inlines and fieldsets. +Django tabbed admin is compatible with django-grappelli and django-gipsy. + +.. image:: https://box.everhelper.me/attachment/256054/rSqCFM20d245qFlG5z64EgiOVpeuTU3P/341506-h1u4JrpaUan0tG2e/screen.png + :height: 400px + :width: 800 px + +Grappelli: + +.. image:: https://box.everhelper.me/attachment/256057/rSqCFM20d245qFlG5z64EgiOVpeuTU3P/341506-kQnZXKsO0pfrU4cI/screen.png + :height: 400px + :width: 800 px + +******* +Install +******* + +It is strongly recommanded to install this theme from GIT with PIP onto you project virtualenv. + +From PyPi + +.. code-block:: shell-session + + pip install django-tabbed-admin + +From Github + +.. code-block:: shell-session + + https://github.com/omji/django-tabbed-admin#egg=tabbed_admin + + +***** +setup +***** + +Simply add the app in your installed apps list in settings.py + +.. code-block:: python + + INSTALLED_APPS = ( + ... + 'tabbed_admin' + ... + ) + +Django-tabbed-admin by default requires Jquery UI tabs plugin in order to work. It is packaged with the static files required to make it funcitonnal, however, they are not activated by default to avoid a conflict with other libraries. + +In order to activate the Jquery UI statics, add the following line to the project settings: + +.. code-block:: python + + TABBED_ADMIN_USE_JQUERY_UI = True + + +******************** +Configure admin tabs +******************** + +In order to add tabs to a model admin, it should inherit from tabbed_admin.TabbedModelAdmin and contain a tabs attribute. +The tab attribute configuration tries to remain similar to the fieldsets and inlines setup logic. + +Basically, a tuple can be created for each tab exactely the same way as for fieldsets, except that inlines can be added anywhere in between. + +.. code-block:: python + + tab_overview = ( + (None, { + 'fields': ('name', 'bio', 'style') + }), + MusicianInline, + ('Contact', { + 'fields': ('agent', 'phone', 'email') + }) + ) + +Then each tuple have to be passed to a *tabs* attribute prefixed by the verbose name to display within the tab: + +.. code-block:: python + + tabs = [ + ('Overview', tab_overview), + ('Albums', tab_album) + ] + + +A full example would give: + +.. code-block:: python + + from django.contrib import admin + + from tabbed_admin import TabbedModelAdmin + from .models import Band, Musician, Album + + + class MusicianInline(admin.StackedInline): + model = Musician + extra = 1 + + + class AlbumInline(admin.TabularInline): + model = Album + extra = 1 + + + @admin.register(Band) + class BandAdmin(TabbedModelAdmin): + model = Band + + tab_overview = ( + (None, { + 'fields': ('name', 'bio', 'style') + }), + MusicianInline, + ('Contact', { + 'fields': ('agent', 'phone', 'email') + }) + ) + tab_album = ( + AlbumInline, + ) + tabs = [ + ('Overview', tab_overview), + ('Albums', tab_album) + ] + +************************** +Configure tabs dynamically +************************** + +Be warned that the tabs will completely reset the fieldsets and inlines attributes in order to avoid conflicts during the form saving. Both attributes are overwritten with the entries passed to the tabs attribute. For the same reasons, it is highly recommanded not to overwrite get_fieldsets or get_inlines. + +You can pass and modify the tabs dynamically the same way you would do for fieldsets or inlines. + +.. code-block:: python + + def get_tabs(self, request, obj=None): + tabs = self.tabs + if obj is not None: + tab_overview = self.tab_overview + ('Social', { + 'fields': ('website', 'twitter', 'facebook') + }) + tab_ressources = self.tab_ressources + (InterviewInline, ) + tabs = [ + ('Overview', tab_overview), + ('Ressources', tab_ressources) + ] + self.tabs = tabs + return super(BandAdmin, self).get_tabs(request, obj) + + +******************** +Change the jquery ui +******************** + +You can change the jquery ui css and js by either overriding the media in the +admin class + +.. code-block:: python + + class Media: + css = { + 'all': ('css/jquery-ui.theme.min.css',) + } + +or by changing the the following settings, + +`TABBED_ADMIN_JQUERY_UI_CSS` and `TABBED_ADMIN_JQUERY_UI_JS` + +.. code-block:: python + + TABBED_ADMIN_JQUERY_UI_CSS = 'static/css/my-custom-jquery-ui.css' + TABBED_ADMIN_JQUERY_UI_JS = 'static/js/my-custom-jquery-ui.js' + + +Contribution +************ + +Please feel free to contribute. Any help and advices are much appreciated. +You will find an example application to run and develop the library easily. + + +***** +LINKS +***** + +Development: + https://github.com/omji/django-tabbed-admin + +Package: + https://pypi.python.org/pypi/django-tabbed-admin + + +%prep +%autosetup -n django-tabbed-admin-1.0.4 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-django-tabbed-admin -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.4-1 +- Package Spec generated @@ -0,0 +1 @@ +03dff5452d220dd2e2060b0d5cd6da65 django-tabbed-admin-1.0.4.tar.gz |