accounts package
Subpackages
Submodules
accounts.admin module
accounts.apps module
accounts.models module
- class accounts.models.User(id, password, last_login, is_superuser, username, first_name, last_name, is_staff, is_active, date_joined, email, phone_number, gstin, company_name, address, user_role)[source]
Bases:
AbstractUser
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- USER_ROLE_CHOICES = [('procurement_officer', 'Procurement Officer'), ('vendor', 'Vendor')]
- address
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- company_name
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_joined
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- email
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- first_name
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_date_joined(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=True, **kwargs)
- get_previous_by_date_joined(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=False, **kwargs)
- get_user_role_display(*, field=<django.db.models.fields.CharField: user_role>)
- groups
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- gstin
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- gstin_validator = <django.core.validators.RegexValidator object>
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- inventory_set
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- is_active
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_staff
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_superuser
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_login
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_name
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- logentry_set
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- outstandingtoken_set
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- password
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- phone_number
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- phone_number_regex = <django.core.validators.RegexValidator object>
- supplierbid_set
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- user_permissions
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- user_role
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- username
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- vendor
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
- class accounts.models.Vendor(id, vendor_certified, vendor_type, contract_expiry_date, vendor_rating, total_ratings, user)[source]
Bases:
Model
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- VENDOR_TYPE_CHOICES = [('supplier', 'Supplier'), ('manufacturer', 'Manufacturer'), ('service_provider', 'Service Provider')]
- contract_expiry_date
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_contract_expiry_date(*, field=<django.db.models.fields.DateField: contract_expiry_date>, is_next=True, **kwargs)
- get_previous_by_contract_expiry_date(*, field=<django.db.models.fields.DateField: contract_expiry_date>, is_next=False, **kwargs)
- get_vendor_type_display(*, field=<django.db.models.fields.CharField: vendor_type>)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>
- total_ratings
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- user
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- user_id
- vendor_certified
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- vendor_rating
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- vendor_type
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
accounts.permissions module
accounts.serializers module
- class accounts.serializers.MyTokenObtainPairSerializer(*args, **kwargs)[source]
Bases:
TokenObtainPairSerializer
- class accounts.serializers.PasswordResetConfirmSerializer(*args, **kwargs)[source]
Bases:
Serializer
- class accounts.serializers.ProcurementOfficerRegisterSerializer(*args, **kwargs)[source]
Bases:
ModelSerializer
- class Meta[source]
Bases:
object
- fields = ('first_name', 'last_name', 'username', 'email', 'phone_number', 'gstin', 'company_name', 'address', 'password1', 'password2')
- create(validated_data)[source]
We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:
return ExampleModel.objects.create(**validated_data)
If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:
example_relationship = validated_data.pop(‘example_relationship’) instance = ExampleModel.objects.create(**validated_data) instance.example_relationship = example_relationship return instance
The default implementation also does not handle nested relationships. If you want to support writable nested relationships you’ll need to write an explicit .create() method.
- class accounts.serializers.ProfileSerializer(*args, **kwargs)[source]
Bases:
ModelSerializer
- class accounts.serializers.VendorRegisterSerializer(*args, **kwargs)[source]
Bases:
ModelSerializer
- class Meta[source]
Bases:
object
- fields = ('first_name', 'last_name', 'username', 'email', 'phone_number', 'gstin', 'company_name', 'address', 'password1', 'password2', 'vendor_info')
- create(validated_data)[source]
We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:
return ExampleModel.objects.create(**validated_data)
If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:
example_relationship = validated_data.pop(‘example_relationship’) instance = ExampleModel.objects.create(**validated_data) instance.example_relationship = example_relationship return instance
The default implementation also does not handle nested relationships. If you want to support writable nested relationships you’ll need to write an explicit .create() method.
accounts.tasks module
accounts.tests module
- class accounts.tests.ChangePasswordViewTests(methodName='runTest')[source]
Bases:
SetUpUsers
,APITestCase
- class accounts.tests.PasswordResetConfirmViewTests(methodName='runTest')[source]
Bases:
APITestCase
- class accounts.tests.PasswordResetViewTests(methodName='runTest')[source]
Bases:
SetUpUsers
,APITestCase
- class accounts.tests.ProcurementOfficerRegisterViewTests(methodName='runTest')[source]
Bases:
APITestCase
- class accounts.tests.TokenViewTests(methodName='runTest')[source]
Bases:
SetUpUsers
,APITestCase
- class accounts.tests.UserProfileViewTests(methodName='runTest')[source]
Bases:
SetUpUsers
accounts.urls module
accounts.views module
- class accounts.views.ChangePasswordView(**kwargs)[source]
Bases:
UpdateAPIView
- get_object()[source]
Returns the object the view is displaying.
You may want to override this if you need to provide non-standard queryset lookups. Eg if objects are referenced using multiple keyword arguments in the url conf.
- queryset = <QuerySet [<User: sahil>, <User: admin>]>
- serializer_class
alias of
ChangePasswordSerializer
- class accounts.views.DeleteUserProfileView(**kwargs)[source]
Bases:
DestroyAPIView
- fields = '__all__'
- get_object()[source]
Returns the object the view is displaying.
You may want to override this if you need to provide non-standard queryset lookups. Eg if objects are referenced using multiple keyword arguments in the url conf.
- permission_classes = [<rest_framework.permissions.OperandHolder object>]
- queryset = <QuerySet [<User: sahil>, <User: admin>]>
- serializer_class
alias of
ModelSerializer
- class accounts.views.MyTokenObtainPairView(**kwargs)[source]
Bases:
TokenObtainPairView
- permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
- serializer_class
alias of
MyTokenObtainPairSerializer
- class accounts.views.MyTokenRefreshView(**kwargs)[source]
Bases:
TokenRefreshView
- permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
- class accounts.views.PasswordResetConfirmView(**kwargs)[source]
Bases:
UpdateAPIView
- get_object()[source]
Returns the object the view is displaying.
You may want to override this if you need to provide non-standard queryset lookups. Eg if objects are referenced using multiple keyword arguments in the url conf.
- permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
- serializer_class
alias of
PasswordResetConfirmSerializer
- class accounts.views.PasswordResetView(**kwargs)[source]
Bases:
CreateAPIView
- permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
- serializer_class
alias of
PasswordResetSerializer
- class accounts.views.ProcurementOfficerRegisterView(**kwargs)[source]
Bases:
CreateAPIView
- permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
- queryset = <QuerySet [<User: sahil>, <User: admin>]>
- serializer_class
alias of
ProcurementOfficerRegisterSerializer
- class accounts.views.UpdateUserProfileView(**kwargs)[source]
Bases:
UpdateAPIView
- get_object()[source]
Returns the object the view is displaying.
You may want to override this if you need to provide non-standard queryset lookups. Eg if objects are referenced using multiple keyword arguments in the url conf.
- queryset = <QuerySet [<User: sahil>, <User: admin>]>
- serializer_class
alias of
ProfileSerializer
- class accounts.views.UserProfileView(**kwargs)[source]
Bases:
RetrieveAPIView
- get_object()[source]
Returns the object the view is displaying.
You may want to override this if you need to provide non-standard queryset lookups. Eg if objects are referenced using multiple keyword arguments in the url conf.
- queryset = <QuerySet [<User: sahil>, <User: admin>]>
- serializer_class
alias of
ProfileSerializer
- class accounts.views.VendorRegisterView(**kwargs)[source]
Bases:
CreateAPIView
- permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
- queryset = <QuerySet [<User: sahil>, <User: admin>]>
- serializer_class
alias of
VendorRegisterSerializer