forked from rc/aircox
		
	fix date lookup filters
This commit is contained in:
		@ -59,7 +59,8 @@ class EpisodeAdminForm(ModelForm):
 | 
			
		||||
class EpisodeAdmin(PageAdmin):
 | 
			
		||||
    form = EpisodeAdminForm
 | 
			
		||||
    list_display = PageAdmin.list_display
 | 
			
		||||
    list_filter = PageAdmin.list_filter + ('diffusion__start',)
 | 
			
		||||
    list_filter = tuple(f for f in PageAdmin.list_filter if f != 'pub_date') + \
 | 
			
		||||
                        ('diffusion__start', 'pub_date')
 | 
			
		||||
    search_fields = PageAdmin.search_fields + ('parent__title',)
 | 
			
		||||
    # readonly_fields = ('parent',)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -17,8 +17,10 @@ class DateFieldFilter(filters.FieldListFilter):
 | 
			
		||||
        self.date_params = {k: v for k, v in params.items()
 | 
			
		||||
                                if k.startswith(self.field_generic)}
 | 
			
		||||
 | 
			
		||||
        exact_lookup = 'date' if isinstance(field, models.DateTimeField) else 'exact'
 | 
			
		||||
 | 
			
		||||
        # links as: (label, param, input_type|None, value)
 | 
			
		||||
        self.links = [(_('Exact'), self.field_generic + 'exact', self.input_type),
 | 
			
		||||
        self.links = [(_('Exact'), self.field_generic + exact_lookup, self.input_type),
 | 
			
		||||
                      (_('Since'), self.field_generic + 'gte', self.input_type),
 | 
			
		||||
                      (_('Until'), self.field_generic + 'lte', self.input_type)]
 | 
			
		||||
        if field.null:
 | 
			
		||||
 | 
			
		||||
@ -264,7 +264,7 @@ msgstr "catégorie"
 | 
			
		||||
 | 
			
		||||
#: aircox/models/page.py:165
 | 
			
		||||
msgid "publication date"
 | 
			
		||||
msgstr "date de publications"
 | 
			
		||||
msgstr "date de publication"
 | 
			
		||||
 | 
			
		||||
#: aircox/models/page.py:167
 | 
			
		||||
msgid "featured"
 | 
			
		||||
 | 
			
		||||
@ -10,9 +10,9 @@
 | 
			
		||||
                onsubmit="return this.{{ choice.name }}.value ? true : false"">
 | 
			
		||||
            <label for="filter-{{ choice.name }}">{{ choice.label }}: </label>
 | 
			
		||||
            <input id="filter-{{ choice.name }}" type="{{ choice.type }}" name="{{ choice.name }}"
 | 
			
		||||
                value="{{ choice.value }}" {{ choice.extra }} />
 | 
			
		||||
                value="{{ choice.value }}" {{ choice.extra }}/>
 | 
			
		||||
            {% for k, v in choice.query_attrs.items %}
 | 
			
		||||
            <input type="hidden" name="{{k}}" value="{{v}}" />
 | 
			
		||||
            <input type="hidden" name="{{k}}" value="{{v}}"/>
 | 
			
		||||
            {% endfor %}
 | 
			
		||||
            <button class="button"><img src="{% static "admin/img/search.svg" %}" /></button>
 | 
			
		||||
        </form>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user