summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-12 04:51:25 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-12 04:51:25 +0000
commit3a186f6575c83b5be7b97b9ea85a2092eb5c73cf (patch)
treeac1650d48f1ff4b83185c84911887c9d08755fd9
parent803f095278ca0e04369b96b0a8ff7ed37fd5f3af (diff)
automatic import of python-dal-admin-filters
-rw-r--r--.gitignore1
-rw-r--r--python-dal-admin-filters.spec577
-rw-r--r--sources1
3 files changed, 579 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..4c9c1c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/dal_admin_filters-1.1.0.tar.gz
diff --git a/python-dal-admin-filters.spec b/python-dal-admin-filters.spec
new file mode 100644
index 0000000..2b029f2
--- /dev/null
+++ b/python-dal-admin-filters.spec
@@ -0,0 +1,577 @@
+%global _empty_manifest_terminate_build 0
+Name: python-dal-admin-filters
+Version: 1.1.0
+Release: 1
+Summary: Django autocomplete light filters for django admin
+License: MIT
+URL: https://github.com/shamanu4/dal_admin_filters
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ba/04/f4a819221df65552d4a37ab230e79f23de9b16bc48f99b894080079e955d/dal_admin_filters-1.1.0.tar.gz
+BuildArch: noarch
+
+Requires: python3-django-autocomplete-light
+
+%description
+# dal_admin_filters
+
+## Django-autocomplete-light filters for django admin.
+
+default select2 widget
+
+![alt text](https://raw.githubusercontent.com/shamanu4/dal_admin_filters/master/shot_01.png "Admin filter with Select2 input")
+
+widget with title as placeholder
+
+![alt text](https://raw.githubusercontent.com/shamanu4/dal_admin_filters/master/shot_02.png "Admin filter with Select2 input and placeholder title")
+
+## Requirements
+
+This is extension for django-autocomplete-light so you need to install and configure it too.
+
+Here will be minimum setup for example.
+
+Refer to http://django-autocomplete-light.readthedocs.io/ for more detailed instructions.
+
+## Installation
+
+- Install using pip
+
+ ```
+ pip install django-autocomplete-light dal_admin_filters
+ ```
+
+- Update INSTALLED_APPS, you need too put django-autocomplete-light before admin
+
+ ```python
+ INSTALLED_APPS = [
+ 'dal',
+ 'dal_select2',
+ 'dal_admin_filters',
+ #
+ 'django.contrib.admin',
+ ... other stuff there ...
+ ]
+ ```
+
+## Configuration
+
+- Create autocomplete view
+
+ - Let our models look like this
+
+ ```python
+ class Country(models.Model):
+ name = models.CharField(max_length=100, unique=True)
+
+ def __str__(self):
+ return self.name
+
+
+ class Person(models.Model):
+ name = models.CharField(max_length=100, unique=True)
+ from_country = models.ForeignKey(Country)
+
+ def __str__(self):
+ return self.name
+
+ ```
+
+ - Then autocomplete view for country selection will be similar to next
+
+ ```python
+ from dal import autocomplete
+ from your_countries_app.models import Country
+
+ class CountryAutocomplete(autocomplete.Select2QuerySetView):
+ def get_queryset(self):
+ # Don't forget to filter out results depending on the visitor !
+ if not self.request.user.is_authenticated():
+ return Country.objects.none()
+
+ qs = Country.objects.all()
+
+ if self.q:
+ qs = qs.filter(name__istartswith=self.q)
+
+ return qs
+ ```
+
+- Register view in urls.py
+
+ ```python
+ from your_countries_app.views import CountryAutocomplete
+
+ urlpatterns = [
+ url(
+ r'^country-autocomplete/$',
+ CountryAutocomplete.as_view(),
+ name='country-autocomplete',
+ ),
+ url(r'^admin/', admin.site.urls),
+ ]
+ ```
+
+- Use filter in your admin.py
+
+ ```python
+ from django.contrib import admin
+ from your_countries_app.models import Country, Person
+ from dal_admin_filters import AutocompleteFilter
+
+
+ @admin.register(Country)
+ class CountryAdmin(admin.ModelAdmin):
+ pass
+
+
+ class CountryFilter(AutocompleteFilter):
+ title = 'Country from' # filter's title
+ field_name = 'from_country' # field name - ForeignKey to Country model
+ autocomplete_url = 'country-autocomplete' # url name of Country autocomplete view
+
+
+ class CountryPlaceholderFilter(AutocompleteFilter):
+ title = 'Country from' # filter's title
+ field_name = 'from_country' # field name - ForeignKey to Country model
+ autocomplete_url = 'country-autocomplete' # url name of Country autocomplete view
+ is_placeholder_title = True # filter title will be shown as placeholder
+
+
+ class CountryCustomPlaceholderFilter(AutocompleteFilter):
+ title = 'Country from' # filter's title
+ parameter_name = 'from_country' # field name - ForeignKey to Country model
+ autocomplete_url = 'country-autocomplete' # url name of Country autocomplete view
+ widget_attrs = {
+ 'data-placeholder': 'Filter by country name'
+ }
+
+
+ @admin.register(Person)
+ class PersonAdmin(admin.ModelAdmin):
+ class Media: # Empty media class is required if you are using autocomplete filter
+ pass # If you know better solution for altering admin.media from filter instance
+ # - please contact me or make a pull request
+
+ list_filter = [CountryFilter]
+
+ ```
+
+If setup is done right, you will see the Select2 widget in admin filter in Person's changelist view.
+
+## Define dependencies between filters (forward)
+
+- Define forwards in the filter (example from the demo_project)
+
+ ```python
+ from dal import forward
+
+ class PersonFilter(AutocompleteFilter):
+ autocomplete_url = 'person-autocomplete'
+ title = 'Owner'
+ field_name = 'owner'
+ forwards = [
+ forward.Field(
+ 'from_country__id__exact', # Field name of filter input
+ 'country_id' # Field name passed to the autocomplete_url endpoint
+ )
+ ]
+ ```
+
+Read more at [https://django-autocomplete-light.readthedocs.io/](https://django-autocomplete-light.readthedocs.io/en/master/tutorial.html#filtering-results-based-on-the-value-of-other-fields-in-the-form)
+
+
+
+
+%package -n python3-dal-admin-filters
+Summary: Django autocomplete light filters for django admin
+Provides: python-dal-admin-filters
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-dal-admin-filters
+# dal_admin_filters
+
+## Django-autocomplete-light filters for django admin.
+
+default select2 widget
+
+![alt text](https://raw.githubusercontent.com/shamanu4/dal_admin_filters/master/shot_01.png "Admin filter with Select2 input")
+
+widget with title as placeholder
+
+![alt text](https://raw.githubusercontent.com/shamanu4/dal_admin_filters/master/shot_02.png "Admin filter with Select2 input and placeholder title")
+
+## Requirements
+
+This is extension for django-autocomplete-light so you need to install and configure it too.
+
+Here will be minimum setup for example.
+
+Refer to http://django-autocomplete-light.readthedocs.io/ for more detailed instructions.
+
+## Installation
+
+- Install using pip
+
+ ```
+ pip install django-autocomplete-light dal_admin_filters
+ ```
+
+- Update INSTALLED_APPS, you need too put django-autocomplete-light before admin
+
+ ```python
+ INSTALLED_APPS = [
+ 'dal',
+ 'dal_select2',
+ 'dal_admin_filters',
+ #
+ 'django.contrib.admin',
+ ... other stuff there ...
+ ]
+ ```
+
+## Configuration
+
+- Create autocomplete view
+
+ - Let our models look like this
+
+ ```python
+ class Country(models.Model):
+ name = models.CharField(max_length=100, unique=True)
+
+ def __str__(self):
+ return self.name
+
+
+ class Person(models.Model):
+ name = models.CharField(max_length=100, unique=True)
+ from_country = models.ForeignKey(Country)
+
+ def __str__(self):
+ return self.name
+
+ ```
+
+ - Then autocomplete view for country selection will be similar to next
+
+ ```python
+ from dal import autocomplete
+ from your_countries_app.models import Country
+
+ class CountryAutocomplete(autocomplete.Select2QuerySetView):
+ def get_queryset(self):
+ # Don't forget to filter out results depending on the visitor !
+ if not self.request.user.is_authenticated():
+ return Country.objects.none()
+
+ qs = Country.objects.all()
+
+ if self.q:
+ qs = qs.filter(name__istartswith=self.q)
+
+ return qs
+ ```
+
+- Register view in urls.py
+
+ ```python
+ from your_countries_app.views import CountryAutocomplete
+
+ urlpatterns = [
+ url(
+ r'^country-autocomplete/$',
+ CountryAutocomplete.as_view(),
+ name='country-autocomplete',
+ ),
+ url(r'^admin/', admin.site.urls),
+ ]
+ ```
+
+- Use filter in your admin.py
+
+ ```python
+ from django.contrib import admin
+ from your_countries_app.models import Country, Person
+ from dal_admin_filters import AutocompleteFilter
+
+
+ @admin.register(Country)
+ class CountryAdmin(admin.ModelAdmin):
+ pass
+
+
+ class CountryFilter(AutocompleteFilter):
+ title = 'Country from' # filter's title
+ field_name = 'from_country' # field name - ForeignKey to Country model
+ autocomplete_url = 'country-autocomplete' # url name of Country autocomplete view
+
+
+ class CountryPlaceholderFilter(AutocompleteFilter):
+ title = 'Country from' # filter's title
+ field_name = 'from_country' # field name - ForeignKey to Country model
+ autocomplete_url = 'country-autocomplete' # url name of Country autocomplete view
+ is_placeholder_title = True # filter title will be shown as placeholder
+
+
+ class CountryCustomPlaceholderFilter(AutocompleteFilter):
+ title = 'Country from' # filter's title
+ parameter_name = 'from_country' # field name - ForeignKey to Country model
+ autocomplete_url = 'country-autocomplete' # url name of Country autocomplete view
+ widget_attrs = {
+ 'data-placeholder': 'Filter by country name'
+ }
+
+
+ @admin.register(Person)
+ class PersonAdmin(admin.ModelAdmin):
+ class Media: # Empty media class is required if you are using autocomplete filter
+ pass # If you know better solution for altering admin.media from filter instance
+ # - please contact me or make a pull request
+
+ list_filter = [CountryFilter]
+
+ ```
+
+If setup is done right, you will see the Select2 widget in admin filter in Person's changelist view.
+
+## Define dependencies between filters (forward)
+
+- Define forwards in the filter (example from the demo_project)
+
+ ```python
+ from dal import forward
+
+ class PersonFilter(AutocompleteFilter):
+ autocomplete_url = 'person-autocomplete'
+ title = 'Owner'
+ field_name = 'owner'
+ forwards = [
+ forward.Field(
+ 'from_country__id__exact', # Field name of filter input
+ 'country_id' # Field name passed to the autocomplete_url endpoint
+ )
+ ]
+ ```
+
+Read more at [https://django-autocomplete-light.readthedocs.io/](https://django-autocomplete-light.readthedocs.io/en/master/tutorial.html#filtering-results-based-on-the-value-of-other-fields-in-the-form)
+
+
+
+
+%package help
+Summary: Development documents and examples for dal-admin-filters
+Provides: python3-dal-admin-filters-doc
+%description help
+# dal_admin_filters
+
+## Django-autocomplete-light filters for django admin.
+
+default select2 widget
+
+![alt text](https://raw.githubusercontent.com/shamanu4/dal_admin_filters/master/shot_01.png "Admin filter with Select2 input")
+
+widget with title as placeholder
+
+![alt text](https://raw.githubusercontent.com/shamanu4/dal_admin_filters/master/shot_02.png "Admin filter with Select2 input and placeholder title")
+
+## Requirements
+
+This is extension for django-autocomplete-light so you need to install and configure it too.
+
+Here will be minimum setup for example.
+
+Refer to http://django-autocomplete-light.readthedocs.io/ for more detailed instructions.
+
+## Installation
+
+- Install using pip
+
+ ```
+ pip install django-autocomplete-light dal_admin_filters
+ ```
+
+- Update INSTALLED_APPS, you need too put django-autocomplete-light before admin
+
+ ```python
+ INSTALLED_APPS = [
+ 'dal',
+ 'dal_select2',
+ 'dal_admin_filters',
+ #
+ 'django.contrib.admin',
+ ... other stuff there ...
+ ]
+ ```
+
+## Configuration
+
+- Create autocomplete view
+
+ - Let our models look like this
+
+ ```python
+ class Country(models.Model):
+ name = models.CharField(max_length=100, unique=True)
+
+ def __str__(self):
+ return self.name
+
+
+ class Person(models.Model):
+ name = models.CharField(max_length=100, unique=True)
+ from_country = models.ForeignKey(Country)
+
+ def __str__(self):
+ return self.name
+
+ ```
+
+ - Then autocomplete view for country selection will be similar to next
+
+ ```python
+ from dal import autocomplete
+ from your_countries_app.models import Country
+
+ class CountryAutocomplete(autocomplete.Select2QuerySetView):
+ def get_queryset(self):
+ # Don't forget to filter out results depending on the visitor !
+ if not self.request.user.is_authenticated():
+ return Country.objects.none()
+
+ qs = Country.objects.all()
+
+ if self.q:
+ qs = qs.filter(name__istartswith=self.q)
+
+ return qs
+ ```
+
+- Register view in urls.py
+
+ ```python
+ from your_countries_app.views import CountryAutocomplete
+
+ urlpatterns = [
+ url(
+ r'^country-autocomplete/$',
+ CountryAutocomplete.as_view(),
+ name='country-autocomplete',
+ ),
+ url(r'^admin/', admin.site.urls),
+ ]
+ ```
+
+- Use filter in your admin.py
+
+ ```python
+ from django.contrib import admin
+ from your_countries_app.models import Country, Person
+ from dal_admin_filters import AutocompleteFilter
+
+
+ @admin.register(Country)
+ class CountryAdmin(admin.ModelAdmin):
+ pass
+
+
+ class CountryFilter(AutocompleteFilter):
+ title = 'Country from' # filter's title
+ field_name = 'from_country' # field name - ForeignKey to Country model
+ autocomplete_url = 'country-autocomplete' # url name of Country autocomplete view
+
+
+ class CountryPlaceholderFilter(AutocompleteFilter):
+ title = 'Country from' # filter's title
+ field_name = 'from_country' # field name - ForeignKey to Country model
+ autocomplete_url = 'country-autocomplete' # url name of Country autocomplete view
+ is_placeholder_title = True # filter title will be shown as placeholder
+
+
+ class CountryCustomPlaceholderFilter(AutocompleteFilter):
+ title = 'Country from' # filter's title
+ parameter_name = 'from_country' # field name - ForeignKey to Country model
+ autocomplete_url = 'country-autocomplete' # url name of Country autocomplete view
+ widget_attrs = {
+ 'data-placeholder': 'Filter by country name'
+ }
+
+
+ @admin.register(Person)
+ class PersonAdmin(admin.ModelAdmin):
+ class Media: # Empty media class is required if you are using autocomplete filter
+ pass # If you know better solution for altering admin.media from filter instance
+ # - please contact me or make a pull request
+
+ list_filter = [CountryFilter]
+
+ ```
+
+If setup is done right, you will see the Select2 widget in admin filter in Person's changelist view.
+
+## Define dependencies between filters (forward)
+
+- Define forwards in the filter (example from the demo_project)
+
+ ```python
+ from dal import forward
+
+ class PersonFilter(AutocompleteFilter):
+ autocomplete_url = 'person-autocomplete'
+ title = 'Owner'
+ field_name = 'owner'
+ forwards = [
+ forward.Field(
+ 'from_country__id__exact', # Field name of filter input
+ 'country_id' # Field name passed to the autocomplete_url endpoint
+ )
+ ]
+ ```
+
+Read more at [https://django-autocomplete-light.readthedocs.io/](https://django-autocomplete-light.readthedocs.io/en/master/tutorial.html#filtering-results-based-on-the-value-of-other-fields-in-the-form)
+
+
+
+
+%prep
+%autosetup -n dal-admin-filters-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-dal-admin-filters -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..6e3d8b2
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+5cabae78cb05c6fca9ae8e7847b2cf09 dal_admin_filters-1.1.0.tar.gz