Giter Site home page Giter Site logo

dal_admin_filters's People

Contributors

alfa24 avatar belonesox avatar lunarabbit avatar maks3w avatar maximzemskov avatar mroci avatar ron8mcr avatar saladrai avatar shamanu4 avatar snnwolf avatar xrmx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dal_admin_filters's Issues

'NoneType' object has no attribute '__getitem__'

'NoneType' object has no attribute 'getitem'

in

dal/widgets.py in render, line 130

class OlaGruppoDiStudioFilter(AutocompleteFilter):
    title = 'Gruppo di studio' 
    parameter_name = 'ola_gruppo_di_studio'
    autocomplete_url = 'ola_gruppo-autocomplete'
class OlaGruppoDiStudioAutocomplete(autocomplete.Select2QuerySetView):
    def get_queryset(self):
        if not self.request.user.is_authenticated():
            return OlaGruppoDiStudio.objects.none()
        qs = OlaGruppoDiStudio.objects.all()
        if self.q:
            qs = qs.filter(
                            Q(nome__istartswith=self.q) |
                            Q(ola_instructor__cognome__istartswith=self.q)|
                            Q(ola_instructor__nome__istartswith=self.q)
                          )
        return qs.order_by('nome')

I tested it in two different apps, with two different models schema and parameter name.
Is it caused by some Null value in FK ?

If any news please let me know, I'd like to use this django app widely in my projects

'NoneType' object is not subscriptable

Following along and implementing the example I get "'NoneType' object is not subscriptable".
https://github.com/yourlabs/django-autocomplete-light/blob/master/src/dal/widgets.py#L133
expects attrs to have an 'id' key. It defaults to None and doesn't check before calling the 'id' key.
https://github.com/shamanu4/dal_admin_filters/blob/master/dal_admin_filters/__init__.py#L47
doesn't explicitly set attrs. I haven't looked too much into it. For me everything works if I set a bogus 'id'.

self.rendered_widget = field.widget.render(
    name=self.parameter_name, 
    value=self.used_parameters.get(self.parameter_name, ''), 
    attrs={'id': 1'},
)

But it of course it is not really the way to go.

No source archive on PyPI for 0.3.3

PyPI has a .whl file for 0.3.3 but the source archive (dal_admin_filters-0.3.3.tar.gz) is missing.

If possible, can this be uploaded because currently installing like this fails:
pip install dal-admin-filters-0.3.3 --no-use-wheel

Screen Shot 2019-06-04 at 4 48 59 pm

List behavior

When I use the filter as horizontal, I see the annoying list bullet and have no access to remove it. Why is the list behavior exists anyway? It looks good in either side-filter and horizontal-filter without the list anyway.

prepends "/?=undefined&" in url, removes all filters and redirect to "?e=1"

If I set a datetime or a date filter as frst selection

/?creation_date__gte=2017-03-08+00%3A00%3A00%2B01%3A00&creation_date__lt=2017-03-16+00%3A00%3A00%2B01%3A00

then if I select a dal admin filters of mine the new window location is:

/?=undefined&creation_date__gte=15%2F03%2F2017&creation_date__lte=15%2F03%2F2017&tipo_marketing=3

the erroneous "/?=undefined&" drive the window location in a new url with "?e=1" and all the previosly selected filters removed.

This happens only if a datetime filter preceeds a dal filter, if other sequence of filter appended in url this bug will not be raised.

Actually tested on two different Django platforms

django.core.exceptions.FieldError: Related Field got invalid lookup: id

If in a model is used another primary_key label, different from the classical id name, it should be better use %s__pk__exact instead of %s__id__exact.

I made this change in my fork but I also cleaned the demo-app and the most of dependencies in requirements, so I cannot do a pull request. Just this, in

dal_admin_filters/__init__.py

    def queryset(self, request, queryset):
        if self.value():
            lookup = "%s__id__exact" % self.parameter_name
            return queryset.filter(**{lookup: self.value()})
        else:
            return queryset

became:

    def queryset(self, request, queryset):
        if self.value():
            lookup = "%s__pk__exact" % self.parameter_name
            return queryset.filter(**{lookup: self.value()})
        else:
            return queryset

Using along with dal_queryset_sequence produces AppRegistryNotReady error

image


INSTALLED_APPS = (
    # django apps
    "django.contrib.sites",
    "dal",  # these two need to be before contrib.admin
    "dal_select2",  # these two need to be before contrib.admin
    "dal_queryset_sequence",
    'dal_admin_filters',
    # 'grappelli',
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "django.contrib.humanize",
    # 3rd party apps
    "rest_framework",
    "rest_framework.authtoken",
    "rest_framework_swagger",
    "solo",
    "imagekit",
    "django_extensions",
    "corsheaders",
    "django_nose",
    "taggit",
    "taggit_labels",
    "simple_history",
    "el_pagination",
    "user_messages",  # Add on for django.contrib.messages with offline messaging support
    # 'django_messages',
    # 'djcelery_email',
    "viewflow",
    # 'djcelery',
    "storages",
    # 'simple_email_confirmation',
    # 'djoser',
    "dbtemplates",
    "jsoneditor",
    "adminsortable2",
    "crispy_forms",
    "django_tables2",
    "django_tables2_column_shifter",
    "admin_display_fields_settings",
    "bootstrap3",
    "notifications",
    "rangefilter",
    "django_filters",
    "django_celery_beat",
    "oauth2_provider",
    "social_django",
    "rest_framework_social_oauth2",
    "knox",
    "admin_numeric_filter",
    "admin_totals",
    # 'django_celery_results',
    'import_export',
    'mptt',]

Please see error stacktrace below

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x110b3ac80>
Traceback (most recent call last):
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
    autoreload.raise_last_exception()
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/django/utils/autoreload.py", line 248, in raise_last_exception
    raise _exception[1]
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/django/core/management/__init__.py", line 337, in execute
    autoreload.check_errors(django.setup)()
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/django/apps/registry.py", line 89, in populate
    app_config = AppConfig.create(entry)
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/dal_admin_filters/__init__.py", line 2, in <module>
    from dal import autocomplete
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/dal/autocomplete.py", line 57, in <module>
    from dal_queryset_sequence.fields import (
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/dal_queryset_sequence/fields.py", line 3, in <module>
    from dal_contenttypes.fields import (
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/dal_contenttypes/fields.py", line 3, in <module>
    from django.contrib.contenttypes.models import ContentType
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/django/contrib/contenttypes/models.py", line 134, in <module>
    class ContentType(models.Model):
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/django/db/models/base.py", line 87, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/django/apps/registry.py", line 249, in get_containing_app_config
    self.check_apps_ready()
  File "/Users/somghosh/.virtualenvs/xenia371/lib/python3.7/site-packages/django/apps/registry.py", line 132, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

forward.js is missing

Great package!

I just installed it and got the error that get_forward is not defined ...

I added 'autocomplete_light/forward.js', to the Autocomplete -> Media -> js and it started working.

Django fails with ImportError: No module named 'six' after dal_admin_filters install

hello,
I installed dal_admin_filters with
pipenv install dal_admin_filters

When settings.py includes:
...
INSTALLED_APPS = [
'voiptrunk.apps.VoiptrunkConfig',
'phonenumber_field',
'django_tables2',
'dal',
'dal_select2',
'dal_admin_filters',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
then Django's server shows:
ImportError: No module named 'six'

Commenting out line 'dal_admin_filters', in settings.py remove the above error.

Thoughts ?

Pass in values from other admin filters

Is there a way to pass in a value from a different filter so that we can only display the subset of values? For example I have Publishers which contain Series and I'd like to only show the series that are available within a particular publisher if there is a filter set for publisher.

I think that this might be possible using DAL's forward mechanics, but I have no idea how I would implement that with this module.

Long label/title for filter-item breaks design

The select list is displayed correctly on two lines, with correct width when first fetching items:
screen shot 2017-03-08 at 3 55 32 pm

Though, when you select an item, the input value stays on one line and thus, breaks the layout:
screen shot 2017-03-08 at 3 51 21 pm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.