Passed
Push — master ( c75c17...e5e306 )
by Swen
56s
created

  A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A ocalizedFieldsAdminMixin.__init__() 0 7 1
1
from django.contrib.admin import ModelAdmin
0 ignored issues
show
Configuration introduced by
The import django.contrib.admin could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
2
3
from . import widgets
4
from .fields import LocalizedField
5
6
7
FORMFIELD_FOR_LOCALIZED_FIELDS_DEFAULTS = {
8
    LocalizedField: {'widget': widgets.AdminLocalizedFieldWidget},
9
}
10
11
12
class LocalizedFieldsAdminMixin(ModelAdmin):
13
    """Mixin for making the fancy widgets work in Django Admin."""
14
15
    class Media:
16
        css = {
17
            'all': (
18
                'localized_fields/localized-fields-admin.css',
19
            )
20
        }
21
22
        js = (
23
            'localized_fields/localized-fields-admin.js',
24
        )
25
26
    def __init__(self, *args, **kwargs):
27
        """Initializes a new instance of :see:LocalizedFieldsAdminMixin."""
28
29
        super(LocalizedFieldsAdminMixin, self).__init__(*args, **kwargs)
30
        overrides = FORMFIELD_FOR_LOCALIZED_FIELDS_DEFAULTS.copy()
31
        overrides.update(self.formfield_overrides)
0 ignored issues
show
Bug introduced by
The member formfield_overrides does not seem to be defined here; its definition is on line 32.
Loading history...
32
        self.formfield_overrides = overrides
33