small update in models : idUser and idArtcle are not required anymore to allow anyone to connect and add a new empty book
authorrougeronj
Fri, 03 Apr 2015 15:03:04 +0200
changeset 63 bd7bcfc86232
parent 62 a5f9739dcd46
child 64 8eb98cd4c29d
small update in models : idUser and idArtcle are not required anymore to allow anyone to connect and add a new empty book
server/ammico/models.py
server/ammico/serializers.py
server/authentication/models.py
--- a/server/ammico/models.py	Fri Apr 03 15:02:19 2015 +0200
+++ b/server/ammico/models.py	Fri Apr 03 15:03:04 2015 +0200
@@ -8,7 +8,7 @@
 
 class Book(models.Model):
     user = models.ForeignKey(AmmicoUser, related_name = "books")
-    idArticle = models.CharField(max_length=512, unique=True)
+    idArticle = models.CharField(max_length=512, unique=True, null=True)
     title = models.CharField(max_length=512, blank=True)
     description = models.CharField(max_length=512, blank=True, null=True)
     image = models.URLField(max_length=2048, blank=True)
--- a/server/ammico/serializers.py	Fri Apr 03 15:02:19 2015 +0200
+++ b/server/ammico/serializers.py	Fri Apr 03 15:03:04 2015 +0200
@@ -13,7 +13,7 @@
     
     class Meta:
         model = Book
-        fields = ('id', 'idArticle', 'title', 'description', 'image', 'date')
+        fields = ('id', 'user', 'idArticle', 'title', 'description', 'image', 'date')
         
 class SlideSerializer(serializers.ModelSerializer):
     details = serializers.SerializerMethodField('getStopInfo')
--- a/server/authentication/models.py	Fri Apr 03 15:02:19 2015 +0200
+++ b/server/authentication/models.py	Fri Apr 03 15:03:04 2015 +0200
@@ -1,14 +1,10 @@
-import json
 
-from django.contrib.auth.models import AbstractUser, BaseUserManager
+from django.contrib.auth.models import AbstractUser
 from django.db import models
-from django.utils import timezone
-import requests
 
-from config import URL_JAMESPOT
 
 class AmmicoUser(AbstractUser):
-    idUser = models.CharField(max_length=50, unique=True, blank=True)
+    idUser = models.CharField(max_length=50, blank=True)
     
 class Profile(models.Model):
     user = models.OneToOneField(AmmicoUser)