server - updated python files
This commit is contained in:
parent
715ab49aff
commit
84679636ed
@ -1,5 +1,5 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from .models import Member, Skill, Project, Client, Cell, Channel
|
from .models import Member, Skill, Project, Client, Cell, Channel, Role
|
||||||
|
|
||||||
admin.site.register(Member)
|
admin.site.register(Member)
|
||||||
admin.site.register(Skill)
|
admin.site.register(Skill)
|
||||||
@ -7,3 +7,4 @@ admin.site.register(Project)
|
|||||||
admin.site.register(Client)
|
admin.site.register(Client)
|
||||||
admin.site.register(Cell)
|
admin.site.register(Cell)
|
||||||
admin.site.register(Channel)
|
admin.site.register(Channel)
|
||||||
|
admin.site.register(Role)
|
||||||
|
@ -5,18 +5,22 @@ from django.dispatch import receiver
|
|||||||
|
|
||||||
|
|
||||||
class Member(models.Model):
|
class Member(models.Model):
|
||||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
avatar = models.URLField(blank=True)
|
||||||
avatar = models.URLField()
|
available = models.NullBooleanField(blank=True)
|
||||||
firstname = models.CharField(max_length=255, blank=True, null=True)
|
bio = models.CharField(max_length=255, blank=True, null=True)
|
||||||
lastname = models.CharField(max_length=255, blank=True, null=True)
|
|
||||||
email = models.CharField(max_length=255, blank=True, null=True)
|
|
||||||
number = models.CharField(max_length=255, blank=True, null=True)
|
|
||||||
cell = models.ForeignKey("Cell", on_delete=models.DO_NOTHING, blank=True, null=True)
|
cell = models.ForeignKey("Cell", on_delete=models.DO_NOTHING, blank=True, null=True)
|
||||||
skills = models.ManyToManyField("Skill", blank=True)
|
jabberID = models.CharField(max_length=255, blank=True, null=True)
|
||||||
|
jabberRoom = models.NullBooleanField(blank=True)
|
||||||
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||||
|
number = models.CharField(max_length=255, blank=True, null=True)
|
||||||
projects = models.ManyToManyField("Project", blank=True)
|
projects = models.ManyToManyField("Project", blank=True)
|
||||||
|
pseudo = models.CharField(max_length=255, blank=True, null=True)
|
||||||
|
roles = models.ManyToManyField("Role", blank=True)
|
||||||
|
skills = models.ManyToManyField("Skill", blank=True)
|
||||||
|
website = models.URLField(blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.firstname +' '+ self.lastname
|
return 'Profil de {} '.format(self.user.get_full_name())
|
||||||
|
|
||||||
@receiver(post_save, sender=User)
|
@receiver(post_save, sender=User)
|
||||||
def create_user_profile(sender, instance, created, **kwargs):
|
def create_user_profile(sender, instance, created, **kwargs):
|
||||||
@ -33,10 +37,17 @@ class Skill(models.Model):
|
|||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
class Role(models.Model):
|
||||||
|
name = models.CharField(max_length=255, default='')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
class Project(models.Model):
|
class Project(models.Model):
|
||||||
name = models.CharField(max_length=255, default='')
|
name = models.CharField(max_length=255, default='')
|
||||||
number = models.PositiveIntegerField(default='0')
|
number = models.PositiveIntegerField(default='0', blank=True)
|
||||||
client = models.OneToOneField("Client", on_delete=models.DO_NOTHING)
|
client = models.ForeignKey("Client", on_delete=models.DO_NOTHING)
|
||||||
team = models.ManyToManyField("Member", blank=True)
|
team = models.ManyToManyField("Member", blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -15,16 +15,26 @@ Including another URLconf
|
|||||||
"""
|
"""
|
||||||
from django.conf.urls import url, include
|
from django.conf.urls import url, include
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.views.generic import TemplateView
|
||||||
from djangoldp.views import LDPViewSet
|
from djangoldp.views import LDPViewSet
|
||||||
from .models import Member, Skill, Project, Client, Cell, Channel
|
from django.conf import settings
|
||||||
|
from .models import Member, Skill, Project, Client, Cell, Channel, Role
|
||||||
|
from .views import userinfocustom
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
url(r'^$', TemplateView.as_view(template_name="index.html"), name="index"),
|
||||||
|
url(r'^accounts/', include('django.contrib.auth.urls')),
|
||||||
url(r'^admin/', admin.site.urls),
|
url(r'^admin/', admin.site.urls),
|
||||||
url(r'^members/', LDPViewSet.urls(model=Member, nested_field="skills")),
|
|
||||||
url(r'^skills/', LDPViewSet.urls(model=Skill)),
|
|
||||||
url(r'^projects/', LDPViewSet.urls(model=Project, nested_field="team")),
|
|
||||||
url(r'^clients/', LDPViewSet.urls(model=Client)),
|
|
||||||
url(r'^cells/', LDPViewSet.urls(model=Cell)),
|
|
||||||
url(r'^channels/', LDPViewSet.urls(model=Channel, nested_field="members")),
|
url(r'^channels/', LDPViewSet.urls(model=Channel, nested_field="members")),
|
||||||
|
url(r'^cells/', LDPViewSet.urls(model=Cell)),
|
||||||
|
url(r'^clients/', LDPViewSet.urls(model=Client)),
|
||||||
|
url(r'^members/', LDPViewSet.urls(model=Member, nested_field="skills")),
|
||||||
|
url(r'^projects/', LDPViewSet.urls(model=Project, nested_field="team")),
|
||||||
|
url(r'^skills/', LDPViewSet.urls(model=Skill)),
|
||||||
|
url(r'^openid/userinfo', userinfocustom),
|
||||||
|
url(r'^openid/', include('oidc_provider.urls', namespace='oidc_provider')),
|
||||||
|
url(r'^role/', LDPViewSet.urls(model=Role)),
|
||||||
|
url(r'^users/', LDPViewSet.urls(model=settings.AUTH_USER_MODEL)),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user