Commit b7d036bd authored by Benoit Alessandroni's avatar Benoit Alessandroni

Fixing the model and some css sugar

parent 1cd24ecf
......@@ -87,7 +87,7 @@ class Mentor(Model):
class Meta:
auto_author = 'user'
serializer_fields=["@id", "phone", "headline", "biography", "skills", "linkedin", "twitter"]
serializer_fields=["@id", "phone", "headline", "biography", "skills", "linkedin", "twitter", "organisation"]
nested_fields=["user", "organisation"]
container_path = 'mentors/'
rdf_type = 'coopstarter:mentor'
......@@ -99,6 +99,24 @@ class Mentor(Model):
def __str__(self):
return self.user.get_full_name()
class Review (Model):
comment = models.TextField(verbose_name="Comment", blank=True)
status = models.CharField(max_length=32, choices=(('pending', 'Pending'), ('inappropriate', 'Inappropriate'), ('validated', 'Validated'), ('to_improve', 'Improvement required')), verbose_name="Resource status", blank=True, null=True)
reviewer = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE, related_name='reviews')
class Meta:
anonymous_perms = ['view']
authenticated_perms = ['inherit', 'add']
owner_field = 'reviewer'
owner_perms = ['inherit', 'change', 'control', 'delete']
container_path = 'reviews/'
rdf_type = 'coopstarter:review'
def __str__(self):
return self.comment
class Resource (Model):
# Mandatory Fields
name = models.CharField(max_length=32, verbose_name="Title")
......@@ -111,7 +129,6 @@ class Resource (Model):
uri = models.CharField(max_length=4086, verbose_name="Location/weblink")
author = models.CharField(max_length=32, verbose_name="Author")
skills = models.TextField(verbose_name="Learning outcomes/skills")
conversations = models.ManyToManyField(Conversation, blank=True)
# Complementary fields
description = models.TextField(verbose_name="Description")
......@@ -130,11 +147,13 @@ class Resource (Model):
related = models.ManyToManyField("self", blank=True)
conversations = models.ManyToManyField(Conversation, blank=True, related_name='resources')
likes = models.ManyToManyField(Like, blank=True, related_name='resources')
review = models.OneToOneField(Review, verbose_name="Associated review", null=True, related_name='resource')
class Meta:
owner_field = 'submitter'
owner_perms = ['inherit', 'change', 'control', 'delete']
nested_fields=["format", "conversations", "steps", "language", "fields", "type", "submitter", "related", "likes"]
nested_fields=["format", "conversations", "steps", "language", "fields",\
"type", "submitter", "related", "likes", "review"]
container_path = 'resources/'
rdf_type = 'coopstarter:resource'
anonymous_perms = ['view']
......@@ -174,21 +193,4 @@ class Request (Model):
return self.country.name
def __str__(self):
return self.name
class Review (Model):
resource = models.ForeignKey(Resource, verbose_name="Associated resource", blank=True, related_name='reviews')
comment = models.TextField(verbose_name="Comment")
status = models.CharField(max_length=32, choices=(('pending', 'Pending'), ('inappropriate', 'Inappropriate'), ('validated', 'Validated'), ('to_improve', 'Improvement required')), verbose_name="Resource status", blank=True, null=True)
reviewer = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE, related_name='reviews')
class Meta:
anonymous_perms = ['view']
authenticated_perms = ['inherit', 'add']
owner_field = 'submitter'
owner_perms = ['inherit', 'change', 'control', 'delete']
def __str__(self):
return self.comment
\ No newline at end of file
return self.name
\ No newline at end of file
......@@ -5,7 +5,7 @@
{% block title %}{% trans "Register for an account" %}{% endblock %}
{% block content %}
<div class="no-sidebar contener" id="splash">
<div class="no-sidebar container" id="splash">
<div class="flex">
<div class="block_log">
<figure class="img_log">
......
......@@ -4,7 +4,7 @@
{% block content %}
<div class="no-sidebar contener" id="splash">
<div class="no-sidebar container" id="splash">
{% if form.errors %}
<p class="flex">
Your username and password didn't match. Please try again.
......
......@@ -6,5 +6,5 @@ class PendingResourcesViewSet(LDPViewSet):
def get_queryset(self, *args, **kwargs):
return super().get_queryset(*args, **kwargs)\
.filter(reviews=None, language__in=self.request.user.mentor_profile.languages.all(), fields__in=self.request.user.mentor_profile.fields.all())\
.filter(review=None, language__in=self.request.user.mentor_profile.languages.all(), fields__in=self.request.user.mentor_profile.fields.all())\
.exclude(submitter=self.request.user)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment