%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.aliyun.com/pypi/web/packages/bd/09/2418b8c496140231ec75efa3746f57ac246f0646ee8fd5e86ca5bc6c27f5/django-singleton-admin-2-1.1.0.tar.gz BuildArch: noarch %description [![PyPI version](https://badge.fury.io/py/django-singleton-admin-2.svg)](https://badge.fury.io/py/django-singleton-admin-2) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/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 [![PyPI version](https://badge.fury.io/py/django-singleton-admin-2.svg)](https://badge.fury.io/py/django-singleton-admin-2) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/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 [![PyPI version](https://badge.fury.io/py/django-singleton-admin-2.svg)](https://badge.fury.io/py/django-singleton-admin-2) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/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 * Thu Jun 08 2023 Python_Bot - 1.1.0-1 - Package Spec generated