pfunk.tests
View Source
from pfunk import Collection, StringField, EnumField, Enum, ReferenceField, SlugField from pfunk.resources import Index from pfunk.contrib.auth.collections import User, Group from pfunk.contrib.auth.resources import GenericGroupBasedRole, GenericUserBasedRole GENDER_PRONOUN = Enum(name='gender_pronouns', choices=['he', 'her', 'they']) class SimpleIndex(Index): name = 'simple-index' terms = ['name', 'slug'] unique = True source = 'Project' class Sport(Collection): use_crud_functions = True name = StringField(required=True) slug = SlugField() def __unicode__(self): return self.name class Meta: unique_together = [('name', 'slug')] class Person(Collection): collection_roles = [GenericGroupBasedRole] verbose_plural_name = 'people' first_name = StringField(required=True) last_name = StringField(required=True) gender_pronoun = EnumField(GENDER_PRONOUN) sport = ReferenceField(Sport) group = ReferenceField(Group) def __unicode__(self): return f"{self.first_name} {self.last_name}" class House(Collection): collection_roles = [GenericUserBasedRole] address = StringField(required=True) user = ReferenceField(User) def __unicode__(self): return self.address
View Source
class SimpleIndex(Index): name = 'simple-index' terms = ['name', 'slug'] unique = True source = 'Project'
Inherited Members
View Source
class Sport(Collection): use_crud_functions = True name = StringField(required=True) slug = SlugField() def __unicode__(self): return self.name class Meta: unique_together = [('name', 'slug')]
Base class for all pFunk Collection classes. In Fauna, a Collection is analogous to a table in Postgresql or MySQL. This class is analogous to a model in Django.
Specifies whether to create the CRUD functions
Inherited Members
- pfunk.collection.Collection
- Collection
- BUILTIN_DOC_ATTRS
- collection_functions
- collection_indexes
- collection_roles
- all_index
- crud_functions
- use_crud_views
- crud_views
- require_auth
- non_public_fields
- verbose_plural_name
- collection_name
- collection_views
- protected_vars
- get_fields
- get_collection_name
- get_enums
- get_verbose_plural_name
- all_index_name
- all_function_name
- call_function
- client
- create
- publish
- publish_functions
- publish_roles
- publish_indexes
- unpublish
- get_unique_together
- get_db_values
- get_foreign_fields_by_type
- call_signals
- get_data_dict
- save
- get
- all
- get_by
- get_index
- delete
- delete_from_id
- to_dict
- urls
- valley.schema.BaseSchema
- process_schema_kwargs
- validate
- get_class_name
- to_json
View Source
class Meta: unique_together = [('name', 'slug')]
View Source
class Person(Collection): collection_roles = [GenericGroupBasedRole] verbose_plural_name = 'people' first_name = StringField(required=True) last_name = StringField(required=True) gender_pronoun = EnumField(GENDER_PRONOUN) sport = ReferenceField(Sport) group = ReferenceField(Group) def __unicode__(self): return f"{self.first_name} {self.last_name}"
Base class for all pFunk Collection classes. In Fauna, a Collection is analogous to a table in Postgresql or MySQL. This class is analogous to a model in Django.
Roles that are attached to this collection.
Overrides the default plural collection name.
Inherited Members
- pfunk.collection.Collection
- Collection
- BUILTIN_DOC_ATTRS
- collection_functions
- collection_indexes
- all_index
- use_crud_functions
- crud_functions
- use_crud_views
- crud_views
- require_auth
- non_public_fields
- collection_name
- collection_views
- protected_vars
- get_fields
- get_collection_name
- get_enums
- get_verbose_plural_name
- all_index_name
- all_function_name
- call_function
- client
- create
- publish
- publish_functions
- publish_roles
- publish_indexes
- unpublish
- get_unique_together
- get_db_values
- get_foreign_fields_by_type
- call_signals
- get_data_dict
- save
- get
- all
- get_by
- get_index
- delete
- delete_from_id
- to_dict
- urls
- valley.schema.BaseSchema
- process_schema_kwargs
- validate
- get_class_name
- to_json
View Source
class House(Collection): collection_roles = [GenericUserBasedRole] address = StringField(required=True) user = ReferenceField(User) def __unicode__(self): return self.address
Base class for all pFunk Collection classes. In Fauna, a Collection is analogous to a table in Postgresql or MySQL. This class is analogous to a model in Django.
Roles that are attached to this collection.
Inherited Members
- pfunk.collection.Collection
- Collection
- BUILTIN_DOC_ATTRS
- collection_functions
- collection_indexes
- all_index
- use_crud_functions
- crud_functions
- use_crud_views
- crud_views
- require_auth
- non_public_fields
- verbose_plural_name
- collection_name
- collection_views
- protected_vars
- get_fields
- get_collection_name
- get_enums
- get_verbose_plural_name
- all_index_name
- all_function_name
- call_function
- client
- create
- publish
- publish_functions
- publish_roles
- publish_indexes
- unpublish
- get_unique_together
- get_db_values
- get_foreign_fields_by_type
- call_signals
- get_data_dict
- save
- get
- all
- get_by
- get_index
- delete
- delete_from_id
- to_dict
- urls
- valley.schema.BaseSchema
- process_schema_kwargs
- validate
- get_class_name
- to_json