From 77ebfecdd9b65a079b128aa3f15fc089218811d5 Mon Sep 17 00:00:00 2001 From: Fabien Quatravaux <fabien.quatravaux@riseup.net> Date: Wed, 10 Jun 2020 17:42:34 +0200 Subject: [PATCH] feature: Add Contact model --- djangoldp_profile/models.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/djangoldp_profile/models.py b/djangoldp_profile/models.py index cc5cf06..0703065 100644 --- a/djangoldp_profile/models.py +++ b/djangoldp_profile/models.py @@ -33,6 +33,29 @@ class Profile(Model): def __str__(self): return '{} ({})'.format(self.user.get_full_name(), self.user.username) +class Contact(Model): + fullName = models.CharField(max_length=255) + givenName = models.CharField(max_length=255, blank=True) + familyName = models.CharField(max_length=255, blank=True) + email = models.EmailField(max_length=254, blank=True) + phone = models.CharField(max_length=255, blank=True) + role = models.CharField(max_length=255, blank=True) + + class Meta(Model.Meta): + anonymous_perms = [] + authenticated_perms = [] + owner_perms = [] + rdf_type = 'vcard:Individual' + rdf_context = { + 'fullName': 'vcard:fn', + 'givenName': 'vcard:given-name', + 'familyName': 'vcard:family-name', + 'email': 'vcard:hasEmail', + 'phone': 'vcard:hasTelephone', + 'role': 'vcard:role' + } + def __str__(self): + return self.fullName @receiver(post_save, sender=settings.AUTH_USER_MODEL) def create_user_profile(sender, instance, created, **kwargs): -- GitLab