Modèle ClientProfile

Modèle de profil client.

Ce module définit le profil client qui étend les informations de base de l’utilisateur avec des données spécifiques aux clients.

class users.models.client.ClientProfile(*args, **kwargs)

Bases : Model

Profil client lié à un utilisateur.

Étend les informations de base d’un utilisateur avec des données spécifiques aux clients : nom, prénom, téléphone et clé chiffrée générée automatiquement pour la sécurité.

Variables:
  • user (User) – Relation one-to-one avec l’utilisateur de base

  • nom (str) – Nom de famille du client

  • prenom (str) – Prénom du client

  • telephone (str) – Numéro de téléphone du client

  • cle_chiffree (str) – Clé chiffrée générée automatiquement

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 a ForwardOneToOneDescriptor instance.

nom

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

prenom

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

telephone

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cle_chiffree

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

save(*args, **kwargs)

Sauvegarde le profil client avec génération automatique de la clé chiffrée.

Génère automatiquement une clé chiffrée basée sur l’email et le nom si elle n’existe pas déjà.

Paramètres:
  • args – Arguments positionnels pour la méthode save

  • kwargs – Arguments nommés pour la méthode save

exception DoesNotExist

Bases : ObjectDoesNotExist

exception MultipleObjectsReturned

Bases : MultipleObjectsReturned

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>
ticket_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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

user_id