Exemplo n.º 1
0
class Profile(Resource):
    LANGUAGE_CHOICES = (
        ('en', 'English'),
        ('es', 'Spanish'),
    )
    id = fields.IntegerField(primary=True, editable=False)
    email = fields.CharField()
    first_name = fields.CharField(verbose_name="First Name", required=False)
    last_name = fields.CharField(verbose_name="Last Name", required=False)
    language = fields.CharField(required=True, choices=LANGUAGE_CHOICES)

    created_by = fields.CharField(editable=False)
    created_at = fields.CharField(editable=False)
    modified_by = fields.CharField(editable=False)
    modified_at = fields.CharField(editable=False)

    subscriptions = fields.ToManyField(
        'subscriptions', 'profiles.models.Subscription',
        get_itm_params=get_subs_params)

    class Meta:
        resource_name = 'profile'
        list = r'^profiles/$'
        item = r'^profiles/(?P<id>\d)/$'
        client = profiles_client
Exemplo n.º 2
0
        class Author(Resource):
            id = fields.IntegerField(primary_key=True)
            name = fields.CharField()

            class Meta:
                list = (r'^author/$', 'author_set')
                item = r'^author/(?P<id>\d)$'
                client = self.client
Exemplo n.º 3
0
        class Issue(Resource):
            id = fields.IntegerField(primary_key=True)
            title = fields.CharField()
            description = fields.TextField()

            class Meta:
                list = r'^issue/$'
                item = r'^issue/(?P<id>\d+)$'
                client = self.client
Exemplo n.º 4
0
        class Store(Resource):
            id = fields.IntegerField(primary_key=True)
            name = fields.CharField()

            class Meta:
                resource_name = 'store'
                list = r'^store/$'
                item = r'^store/(?P<id>\d)$'
                client = self.client
                verbose_name = 'Storage'
                verbose_name_plural = 'Storages'
Exemplo n.º 5
0
        class Author(Resource):
            id = fields.IntegerField(primary_key=True)
            name = fields.CharField()

            class Meta:
                resource_name = 'author'
                list = (r'^author/$', 'author_set')
                item = r'^author/(?P<id>\d)$'
                client = self.client
                verbose_name = 'Author'
                verbose_name_plural = 'Authors'
Exemplo n.º 6
0
class Subscription(Resource):
    VENDOR_CHOICES = (
        ('smartfocus', 'Smart Focus'),
    )
    id = fields.IntegerField(primary=True, editable=False)
    profile = fields.ToOneField('profile', Profile)
    vendor_slug = fields.CharField(required=True, choices=VENDOR_CHOICES)
    vendor_name = fields.CharField(editable=False)
    enabled = fields.BooleanField(default=True)

    created_by = fields.CharField(editable=False)
    created_at = fields.CharField(editable=False)
    modified_by = fields.CharField(editable=False)
    modified_at = fields.CharField(editable=False)

    class Meta:
        resource_name = 'subscription'
        list = r'^subscriptions/$'
        item = r'^subscriptions/(?P<id>\d)/$'
        client = profiles_client
Exemplo n.º 7
0
        class Book(SimpleResource):
            isbn = fields.IntegerField(primary_key=True)

            class Meta:
                list = r'^book/$'
                client = self.client