Esempio n. 1
0
 class Meta:
     queryset = EventType.objects.all()
     resource_name = 'event'
     allowed_methods = ['get']
     filter = {'pk': ALL}
     authorization = ReadOnlyAuthorization()
     authentication = BasicAuthentication()
Esempio n. 2
0
 class Meta:
     cache = HttpCache(control={
         'max_age': 1800,
         's_maxage': 1800,
         'public': True
     })
     queryset = Event.objects.all()
     resource_name = 'event'
     authentication = Authentication()
     authorization = ReadOnlyAuthorization()
     serializer = iCalSerializer(formats=['json', 'jsonp', 'ical'])
     allowed_methods = ['get']
     ordering = ['start']
     fields = [
         'name', 'start', 'end', 'timezone', 'venue', 'city', 'region',
         'country', 'lat', 'lon', 'external_link', 'description',
         'mozilla_event', 'owner', 'estimated_attendance'
     ]
     filtering = {
         'name': ALL,
         'city': ALL,
         'region': ALL,
         'country': ALL,
         'start': ALL,
         'end': ALL,
         'categories': ALL_WITH_RELATIONS
     }
Esempio n. 3
0
 class Meta:
     include_resource_uri = False
     allowed_methods = ['get']
     resource_name = 'fare'
     object_class = DictObject       
     authorization= ReadOnlyAuthorization()
     authentication= BasicAuthentication()
Esempio n. 4
0
    class Meta:
        last_id = 0
        queryset = Documento.objects.exclude(url_xml=None).order_by('fecha_publicacion')
        resource_name = 'documento'
        api_name = 'v1',
        detail_uri_name = 'identificador'
        list_allowed_methods = ['get', 'post']
        detail_allowed_methods = ['get', 'post']
        ordering = ['id']
        filtering = {
            'titulo': ALL,
            'identificador': ALL,
            'fecha_publicacion': ALL,
            'diario': ALL_WITH_RELATIONS,
            'seccion' : ALL,
            'materias': ALL_WITH_RELATIONS,
            'legislatura': ALL_WITH_RELATIONS,
            'notas': ALL_WITH_RELATIONS,
            'referencias_anteriores': ALL_WITH_RELATIONS,
            'referencias_posteriores': ALL_WITH_RELATIONS,

        }
        # authentication = BasicAuthentication()
        authorization = ReadOnlyAuthorization()
        paginator_class = EstimatedCountPaginator
        cache = SimpleCache(timeout=60*60*24)
Esempio n. 5
0
 class Meta:
     queryset = UserProfile.objects.filter(registration_complete=True)
     resource_name = 'profile'
     authentication = Authentication()
     authorization = ReadOnlyAuthorization()
     include_resource_uri = False
     include_absolute_url = False
     allowed_methods = ['get']
     fields = [
         'city', 'region', 'country', 'display_name', 'local_name', 'lon',
         'lat', 'mozillians_profile_url', 'twitter_account', 'facebook_url',
         'diaspora_url', 'personal_blog_feed', 'irc_name'
     ]
     ordering = ['country']
     filtering = {
         'display_name': ALL,
         'local_name': ALL,
         'irc_name': ALL,
         'country': ALL,
         'region': ALL,
         'city': ALL,
         'functional_areas': ALL_WITH_RELATIONS,
         'mobilising_skills': ALL_WITH_RELATIONS,
         'mobilising_interests': ALL_WITH_RELATIONS
     }
     max_limit = 40
     throttle = RemoAPIThrottle()
Esempio n. 6
0
 class Meta:
     queryset = Tenure.objects.all()
     resource_name = 'tenure'
     authorization = ReadOnlyAuthorization()
     #fields = ['origin_point', 'fire_boundary', 'area', 'fire_position', 'tenure_id']
     allowed_methods = ['get']
     list_allowed_methods = ['get']
Esempio n. 7
0
    class Meta:
        queryset = FatalEncounter.objects.filter(proofed=True)
        list_allowed_methods = [
            'get',
        ]
        detail_allowed_methods = [
            'get',
        ]
        authorization = ReadOnlyAuthorization()

        excludes = ['proofed', 'photo_url', 'source_url']
        resource_name = 'fatalencounters'
        max_limit = 10000

        filtering = {
            'date_of_injury': ['exact', 'lt', 'lte', 'gte', 'gt'],
            'state': [
                'exact',
            ],
            'city': [
                'exact',
            ],
            'race': [
                'exact',
            ],
        }

        cache = SimpleCache(timeout=10)
        serializer = PrettyJSONSerializer()
Esempio n. 8
0
 class Meta:
     
     queryset = Persona.objects.all()
     authorization = ReadOnlyAuthorization()
     authentication = MultiAuthentication(SessionAuthentication(),
                                          Authentication(),
                                          ApiKeyAuthentication())
Esempio n. 9
0
 class Meta(GCloudModelResource.CommonMeta):
     queryset = CeleryTask.objects.all()
     authorization = ReadOnlyAuthorization()
     resource_name = "celery_task"
     filtering = {
         "enabled": ALL,
     }
Esempio n. 10
0
    class Meta:
        queryset = User.objects.all()
        fields = ['username']
        detail_uri_name = 'username'

        authorization = ReadOnlyAuthorization()
        authentication = ApiKeyAuthentication()
Esempio n. 11
0
 class Meta:
     queryset = UserProfile.objects.select_related()
     authentication = VouchedAuthentication()
     authorization = ReadOnlyAuthorization()
     serializer = TimeSerialize()
     resource_name = 'contact'
     fields = ['display_name', 'id', 'website', 'ircname', 'last_updated']
Esempio n. 12
0
 class Meta:
     queryset = BlogProxy.secondary.published().order_by('-publish_date')
     resource_name = "post"
     fields = [
         'id',
         'title',
         'featured_image',
         'description',
         'publish_date',
         'allow_comments',
         'comments_count',
         'rating_average',
         'rating_count',
         'modified_date',
     ]
     list_allowed_methods = [
         'get',
     ]
     detail_allowed_methods = [
         'get',
     ]
     throttle = CacheDBThrottle()
     filtering = {
         "publish_date": ('gt', ),
     }
     serializer = CamelCaseJSONSerializer()
     authentication = ApiKeyAuthentication()
     authorization = ReadOnlyAuthorization()
     limit = 5
     paginator_class = RestKitPaginator
Esempio n. 13
0
 class Meta:
     queryset = User.objects.all()
     resource_name = 'user'
     fields = ['id', 'username', 'first_name', 'last_name', 'last_login']
     allowed_methods = ['get']
     authentication = OAuth20Authentication()
     authorization = ReadOnlyAuthorization()
Esempio n. 14
0
 class Meta(GCloudModelResource.Meta):
     queryset = CeleryTask.objects.all()
     authorization = ReadOnlyAuthorization()
     resource_name = 'celery_task'
     filtering = {
         'enabled': ALL,
     }
Esempio n. 15
0
 class Meta:
     
     queryset = ItemTemplate.objects.all()
     authorization = ReadOnlyAuthorization()
     authentication = MultiAuthentication(SessionAuthentication(),
                                          Authentication(),
                                          ApiKeyAuthentication()) 
 class Meta:
     class_object = Auth
     authentication = AnonymousAuthentication()
     authorization = ReadOnlyAuthorization()
     list_allowed_methods = ["get"]
     detail_allowed_methods = []
     resource_name = "auth"
Esempio n. 17
0
 class Meta:
     cache = HttpCache(control={
         'max_age': 1800,
         's_maxage': 1800,
         'public': True
     })
     # By default events should be always ordered by start date unless
     # specified by a query parameter
     queryset = Event.objects.all().order_by('start')
     resource_name = 'event'
     authentication = Authentication()
     authorization = ReadOnlyAuthorization()
     serializer = iCalSerializer(formats=['json', 'jsonp', 'ical'])
     allowed_methods = ['get']
     ordering = ['start', 'end']
     fields = [
         'name', 'start', 'end', 'timezone', 'venue', 'city', 'region',
         'country', 'lat', 'lon', 'external_link', 'description',
         'mozilla_event', 'owner', 'estimated_attendance',
         'actual_attendance'
     ]
     filtering = {
         'name': ALL,
         'city': ALL,
         'region': ALL,
         'country': ALL,
         'start': ALL,
         'end': ALL,
         'estimated_attendance': ALL,
         'categories': ALL_WITH_RELATIONS,
         'campaign': ALL_WITH_RELATIONS
     }
     max_limit = 40
     throttle = RemoAPIThrottle()
Esempio n. 18
0
 class Meta:
     authentication = SessionAuthentication()
     authorization = ReadOnlyAuthorization()
     allowed_methods = ['get']
     paginator_class = NoCountPaginator
     # @@@ things will break if a user has more than 500 groups or students
     limit = 500
Esempio n. 19
0
 class Meta:
     queryset = User.objects.all()
     resource_name = 'auth/user'  #api slug reference
     fields = ['username', 'first_name', 'last_name', 'last_login']
     allowed_methods = ['get']
     authentication = BasicAuthentication()
     authorization = ReadOnlyAuthorization()
     serializer = Serializer(formats=['json', 'plist'])
Esempio n. 20
0
 class Meta:
     authentication = DefaultAuthentication()
     authorization = ReadOnlyAuthorization()
     always_return_data = True
     include_resource_uri = False
     serializer = DefaultSerializer()
     validation = DefaultValidation()
     allowed_update_fields = []
Esempio n. 21
0
 class Meta:
     if settings.API_TEST_MODE:
         authentication = Authentication()
         logger.warning('no API authentication active')
     else:
         authentication = ApiKeyAuthentication()
     authorization = ReadOnlyAuthorization()
     serializer = JSONForHTMLSerializer()
Esempio n. 22
0
    class Meta:
        authentication = BaseAuthentication()
        authorization = ReadOnlyAuthorization()
        queryset = Tag.objects.all()

        filtering = {
            'name': ('exact'),
        }
Esempio n. 23
0
 class Meta:
     queryset = ComponentModel.objects.filter(status=True).order_by('name')
     resource_name = 'component'
     excludes = ['status', 'id']
     detail_uri_name = 'code'
     ordering = ['name']
     authorization = ReadOnlyAuthorization()
     limit = 0
Esempio n. 24
0
 class Meta(SearchResource.Meta):
     authorization = ReadOnlyAuthorization()
     authentication = OptionalOAuthAuthentication()
     detail_allowed_methods = []
     fields = SearchResource.Meta.fields + ['id', 'cat']
     list_allowed_methods = ['get']
     resource_name = 'search/featured'
     slug_lookup = None
Esempio n. 25
0
File: api.py Progetto: flyun/zamboni
 class Meta(AppResource.Meta):
     resource_name = 'search'
     allowed_methods = []
     detail_allowed_methods = []
     list_allowed_methods = ['get']
     authorization = ReadOnlyAuthorization()
     authentication = OptionalOAuthAuthentication()
     slug_lookup = None
Esempio n. 26
0
 class Meta:
     queryset = Genre.objects.all()
     filtering = {
         'name': ALL_WITH_RELATIONS,
         'race': ALL_WITH_RELATIONS
     }
     resource_name = 'genre'
     authorization = ReadOnlyAuthorization()
Esempio n. 27
0
 class Meta:
     queryset = VariableModel.objects.filter(status=True)
     resource_name = 'variable'
     excludes = ['status', 'id']
     detail_uri_name = 'code'
     ordering = ['id']
     authorization = ReadOnlyAuthorization()
     limit = 0
Esempio n. 28
0
    class Meta:
        queryset = Question.objects.all()
        resource_name = 'question'
        list_allowed_methods = ['get']
        detail_allowed_methods = ['get']

        authorization = ReadOnlyAuthorization()
        authentication = ApiKeyAuthentication()
Esempio n. 29
0
 class Meta:
     queryset = CourseTag.objects.all()
     allowed_methods = ['get']
     fields = ['id', 'course', 'tag']
     include_resource_uri = False
     authentication = ApiKeyAuthentication()
     authorization = ReadOnlyAuthorization()
     always_return_data = True
Esempio n. 30
0
    class Meta:
        queryset = UserProfile.objects.all()
        resource_name = 'profile'
        list_allowed_methods = []
        detail_allowed_methods = ['get']

        authorization = ReadOnlyAuthorization()
        authentication = ApiKeyAuthentication()