# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### from django.db.models import Q from autocomplete_light.registry import register from autocomplete_light.autocomplete.shortcuts import AutocompleteModelTemplate from .models import Profile class ProfileAutocomplete(AutocompleteModelTemplate): choice_template = 'autocomplete_response.html' def choices_for_request(self): self.choices = self.choices.exclude( Q(username='******') | Q(is_active=False)) return super(ProfileAutocomplete, self).choices_for_request() register( Profile, ProfileAutocomplete, search_fields=['first_name', 'last_name', 'email', 'username'], )
choice_template = 'autocomplete_response.html' class NewsAutocomplete(DocumentAutocomplete): choice_template = 'autocomplete_response.html' class BlogAutocomplete(DocumentAutocomplete): choice_template = 'autocomplete_response.html' class KnowledgehubDocumentAutocomplete(DocumentAutocomplete): choice_template = 'autocomplete_response.html' register( Document, DocumentAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Document name..', }, ) register( Event, EventAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Event name...', }, )
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### from autocomplete_light.registry import register from autocomplete_light.autocomplete.shortcuts import AutocompleteModelTemplate from models import Document class DocumentAutocomplete(AutocompleteModelTemplate): choice_template = 'autocomplete_response.html' register( Document, DocumentAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Nome do documento..', }, )
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### from autocomplete_light.registry import register from autocomplete_light.autocomplete.shortcuts import AutocompleteModelTemplate from models import Layer class LayerAutocomplete(AutocompleteModelTemplate): choice_template = 'autocomplete_response.html' register( Layer, LayerAutocomplete, search_fields=['title', '^alternate'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Nome da camada..', }, )
else: if anonymous_group: self.choices = self.choices.filter( Q(group__isnull=True) | Q(group__in=public_groups) | Q(group=anonymous_group)) else: self.choices = self.choices.filter( Q(group__isnull=True) | Q(group__in=public_groups)) return super(ResourceBaseAutocomplete, self).choices_for_request() register( Region, search_fields=['name'], autocomplete_js_attributes={ 'placeholder': 'Region/Country ..', }, ) register( ResourceBaseAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Resource name..', }, ) register(
self.choices = self.choices.filter(id__in=permitted) self.choices = get_visible_resources( self.choices, request.user if request else None, admin_approval_required=settings.ADMIN_MODERATE_UPLOADS, unpublished_not_visible=settings.RESOURCE_PUBLISHING, private_groups_not_visibile=settings.GROUP_PRIVATE_RESOURCES) return super(ResourceBaseAutocomplete, self).choices_for_request() register( Region, search_fields=['name'], autocomplete_js_attributes={ 'placeholder': 'Região/Cidade ..', }, ) register( ResourceBaseAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Nome recurso..', }, ) register(
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### from django.db.models import Q from autocomplete_light.registry import register from autocomplete_light.autocomplete.shortcuts import AutocompleteModelTemplate from .models import Profile class ProfileAutocomplete(AutocompleteModelTemplate): choice_template = 'autocomplete_response.html' def choices_for_request(self): self.choices = self.choices.exclude(Q(username='******') | Q(is_active=False)) return super(ProfileAutocomplete, self).choices_for_request() register( Profile, ProfileAutocomplete, search_fields=['first_name', 'last_name', 'email', 'username'], )
def choices_for_request(self): self.choices = Layer.objects.filter(id__in=resources_for_site()) return super(LayerAutocomplete, self).choices_for_request() class MapAutocomplete(MapAutocomplete): def choices_for_request(self): self.choices = Map.objects.filter(id__in=resources_for_site()) return super(MapAutocomplete, self).choices_for_request() register( ResourceBaseAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Resource name..', }, ) register( Document, DocumentAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Document name..', }, )
class LayerAutocomplete(LayerAutocomplete): def choices_for_request(self): self.choices = Layer.objects.filter(id__in=resources_for_site()) return super(LayerAutocomplete, self).choices_for_request() class MapAutocomplete(MapAutocomplete): def choices_for_request(self): self.choices = Map.objects.filter(id__in=resources_for_site()) return super(MapAutocomplete, self).choices_for_request() register(ResourceBaseAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={'placeholder': 'Resource name..', }, ) register( Document, DocumentAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Document name..', }, ) register(
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### from autocomplete_light.registry import register from autocomplete_light.autocomplete.shortcuts import AutocompleteModelTemplate from .models import Map class MapAutocomplete(AutocompleteModelTemplate): choice_template = 'autocomplete_response.html' register( Map, MapAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Map name..', }, )
Q(group__isnull=True) | Q(group__in=public_groups) | Q(group__in=group_list_all) | Q(group__in=groups) | Q(owner__username__iexact=str(request.user))) else: if anonymous_group: self.choices = self.choices.filter( Q(group__isnull=True) | Q(group__in=public_groups) | Q(group=anonymous_group)) else: self.choices = self.choices.filter( Q(group__isnull=True) | Q(group__in=public_groups)) return super(ResourceBaseAutocomplete, self).choices_for_request() register(Region, search_fields=['name'], autocomplete_js_attributes={'placeholder': 'Region/Country ..', },) register(ResourceBaseAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={'placeholder': 'Resource name..', },) register(HierarchicalKeyword, search_fields=['name', 'slug'], autocomplete_js_attributes={'placeholder': 'A space or comma-separated list of keywords', },) class ThesaurusKeywordLabelAutocomplete(AutocompleteModelBase):
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### from autocomplete_light.registry import register from autocomplete_light.autocomplete.shortcuts import AutocompleteModelTemplate from models import Map class MapAutocomplete(AutocompleteModelTemplate): choice_template = 'autocomplete_response.html' register( Map, MapAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Map name..', }, )
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### from autocomplete_light.registry import register from autocomplete_light.autocomplete.shortcuts import AutocompleteModelTemplate from models import Layer class LayerAutocomplete(AutocompleteModelTemplate): choice_template = 'autocomplete_response.html' register( Layer, LayerAutocomplete, search_fields=[ 'title', '^alternate'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Layer name..', }, )
# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### from autocomplete_light.registry import register from autocomplete_light.autocomplete.shortcuts import AutocompleteModelTemplate from .models import GroupProfile class GroupProfileAutocomplete(AutocompleteModelTemplate): choice_template = 'autocomplete_response.html' register( GroupProfile, GroupProfileAutocomplete, search_fields=['title'], )
# d: migration #import autocomplete_light #from models import WFPDocument from autocomplete_light.registry import register from autocomplete_light.autocomplete.shortcuts import AutocompleteModelTemplate from models import WFPDocument class WFPDocumentWfpDocsAutocomplete(AutocompleteModelTemplate): choice_template = 'autocomplete_response.html' register( WFPDocument, WFPDocumentWfpDocsAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=30, autocomplete_js_attributes={ 'placeholder': 'Staticmap name..', }, )
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### from autocomplete_light.registry import register from autocomplete_light.autocomplete.shortcuts import AutocompleteModelTemplate from models import Document class DocumentAutocomplete(AutocompleteModelTemplate): choice_template = 'autocomplete_response.html' register( Document, DocumentAutocomplete, search_fields=['title'], order_by=['title'], limit_choices=100, autocomplete_js_attributes={ 'placeholder': 'Document name..', }, )