diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-17 04:16:53 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-17 04:16:53 +0000 |
| commit | 71e00e42106c4796e4e1394e4743aeadca48654e (patch) | |
| tree | cd01aa88e3a568cff83f6f67ce751659bc5bcb51 | |
| parent | f8e7da8a47de124e3c27f28aa23149654a77a53b (diff) | |
automatic import of python-django-singleton-admin-2
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-django-singleton-admin-2.spec | 192 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 194 insertions, 0 deletions
@@ -0,0 +1 @@ +/django-singleton-admin-2-1.1.0.tar.gz diff --git a/python-django-singleton-admin-2.spec b/python-django-singleton-admin-2.spec new file mode 100644 index 0000000..2f0e3d5 --- /dev/null +++ b/python-django-singleton-admin-2.spec @@ -0,0 +1,192 @@ +%global _empty_manifest_terminate_build 0 +Name: python-django-singleton-admin-2 +Version: 1.1.0 +Release: 1 +Summary: Easily edit singleton models in the Django admin site +License: MIT License +URL: https://github.com/porowns/django-singleton-admin +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/bd/09/2418b8c496140231ec75efa3746f57ac246f0646ee8fd5e86ca5bc6c27f5/django-singleton-admin-2-1.1.0.tar.gz +BuildArch: noarch + + +%description +[](https://badge.fury.io/py/django-singleton-admin-2)  + +# Django Singleton Admin +In dynamic applications, it can be somewhat of a pain to have static settings that *have* to be set in `settings.py`. Django Singleton Admin adds an easy way to edit singleton models (e.g a SiteSetting model) to allow administrators to change configuration on the fly. + +This is great for things like OAuth settings for third parties, or dynamic settings that you need to pull for your site. + +# Installation +1. Install with Pip `pip install django-singleton-admin-2` +2. Add `django_singleton_admin` to `INSTALLED_APPS` + +# Influenced By +* https://github.com/RacingTadpole/django-singleton-admin +* https://github.com/lazybird/django-solo + +# Example +``` +# models.py +from django.db import models + +class SiteSettings(models.Model): + site_title = models.CharField(max_length=32) + site_domain = models.CharField(max_length=32) + site_description = models.CharField(max_length=32) + + @staticmethod + def get_instance(): + return SiteSettings.objects.get_or_create(pk=0) + + def __str__(self): + return "Site settings" +``` + +``` +# admin.py +from django.contrib import admin +from .models import SiteSettings +from django_singleton_admin.admin import DjangoSingletonModelAdmin + +admin.site.register(SiteSettings, DjangoSingletonModelAdmin) +``` + +%package -n python3-django-singleton-admin-2 +Summary: Easily edit singleton models in the Django admin site +Provides: python-django-singleton-admin-2 +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-django-singleton-admin-2 +[](https://badge.fury.io/py/django-singleton-admin-2)  + +# Django Singleton Admin +In dynamic applications, it can be somewhat of a pain to have static settings that *have* to be set in `settings.py`. Django Singleton Admin adds an easy way to edit singleton models (e.g a SiteSetting model) to allow administrators to change configuration on the fly. + +This is great for things like OAuth settings for third parties, or dynamic settings that you need to pull for your site. + +# Installation +1. Install with Pip `pip install django-singleton-admin-2` +2. Add `django_singleton_admin` to `INSTALLED_APPS` + +# Influenced By +* https://github.com/RacingTadpole/django-singleton-admin +* https://github.com/lazybird/django-solo + +# Example +``` +# models.py +from django.db import models + +class SiteSettings(models.Model): + site_title = models.CharField(max_length=32) + site_domain = models.CharField(max_length=32) + site_description = models.CharField(max_length=32) + + @staticmethod + def get_instance(): + return SiteSettings.objects.get_or_create(pk=0) + + def __str__(self): + return "Site settings" +``` + +``` +# admin.py +from django.contrib import admin +from .models import SiteSettings +from django_singleton_admin.admin import DjangoSingletonModelAdmin + +admin.site.register(SiteSettings, DjangoSingletonModelAdmin) +``` + +%package help +Summary: Development documents and examples for django-singleton-admin-2 +Provides: python3-django-singleton-admin-2-doc +%description help +[](https://badge.fury.io/py/django-singleton-admin-2)  + +# Django Singleton Admin +In dynamic applications, it can be somewhat of a pain to have static settings that *have* to be set in `settings.py`. Django Singleton Admin adds an easy way to edit singleton models (e.g a SiteSetting model) to allow administrators to change configuration on the fly. + +This is great for things like OAuth settings for third parties, or dynamic settings that you need to pull for your site. + +# Installation +1. Install with Pip `pip install django-singleton-admin-2` +2. Add `django_singleton_admin` to `INSTALLED_APPS` + +# Influenced By +* https://github.com/RacingTadpole/django-singleton-admin +* https://github.com/lazybird/django-solo + +# Example +``` +# models.py +from django.db import models + +class SiteSettings(models.Model): + site_title = models.CharField(max_length=32) + site_domain = models.CharField(max_length=32) + site_description = models.CharField(max_length=32) + + @staticmethod + def get_instance(): + return SiteSettings.objects.get_or_create(pk=0) + + def __str__(self): + return "Site settings" +``` + +``` +# admin.py +from django.contrib import admin +from .models import SiteSettings +from django_singleton_admin.admin import DjangoSingletonModelAdmin + +admin.site.register(SiteSettings, DjangoSingletonModelAdmin) +``` + +%prep +%autosetup -n django-singleton-admin-2-1.1.0 + +%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-singleton-admin-2 -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 17 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.0-1 +- Package Spec generated @@ -0,0 +1 @@ +5286dbdba0416e162e8ff0b0dfbcf752 django-singleton-admin-2-1.1.0.tar.gz |
