From 8c095b0e3fa7fec0fcd648dd77b209a285602d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABlle=20Morin?= <morin.gaelle@gmail.com> Date: Wed, 22 May 2019 14:31:31 +0200 Subject: [PATCH] fix: validation changed on fields --- djangoldp_profile/djangoldp_urls.py | 2 +- djangoldp_profile/factories.py | 3 +- .../migrations/0004_auto_20190524_1349.py | 34 +++++++++++++++++++ djangoldp_profile/models.py | 7 ++-- 4 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 djangoldp_profile/migrations/0004_auto_20190524_1349.py diff --git a/djangoldp_profile/djangoldp_urls.py b/djangoldp_profile/djangoldp_urls.py index d7c9c64..7c6906d 100644 --- a/djangoldp_profile/djangoldp_urls.py +++ b/djangoldp_profile/djangoldp_urls.py @@ -6,6 +6,6 @@ from .models import Profile urlpatterns = [ url(r'^members/', LDPViewSet.urls(model=Profile, - fields=['@id', 'jabberID', 'user', 'available', 'bio', 'city', 'country', 'phone', + fields=['@id', 'jabberID', 'user', 'available', 'bio', 'city', 'phone', 'website'], permission_classes=())), ] diff --git a/djangoldp_profile/factories.py b/djangoldp_profile/factories.py index 97fc6f9..80b7cc9 100644 --- a/djangoldp_profile/factories.py +++ b/djangoldp_profile/factories.py @@ -10,8 +10,7 @@ class ProfileFactory(factory.django.DjangoModelFactory): user = factory.SubFactory(UserFactory) available = factory.Faker('null_boolean') - bio = factory.Faker('text', max_nb_chars=250) + bio = factory.Faker('text', max_nb_chars=145) city = factory.Faker('city') - country = factory.Faker('country') phone = factory.Faker('phone_number') website = factory.Faker('url') diff --git a/djangoldp_profile/migrations/0004_auto_20190524_1349.py b/djangoldp_profile/migrations/0004_auto_20190524_1349.py new file mode 100644 index 0000000..4aa7e57 --- /dev/null +++ b/djangoldp_profile/migrations/0004_auto_20190524_1349.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-05-24 13:49 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangoldp_profile', '0003_move_jabber_picture_20181220_0939'), + ] + + operations = [ + migrations.RemoveField( + model_name='profile', + name='country', + ), + migrations.AlterField( + model_name='profile', + name='bio', + field=models.CharField(blank=True, max_length=150), + ), + migrations.AlterField( + model_name='profile', + name='city', + field=models.CharField(blank=True, max_length=255), + ), + migrations.AlterField( + model_name='profile', + name='phone', + field=models.CharField(blank=True, max_length=255), + ), + ] diff --git a/djangoldp_profile/models.py b/djangoldp_profile/models.py index 57de11c..2ea9ac1 100644 --- a/djangoldp_profile/models.py +++ b/djangoldp_profile/models.py @@ -8,10 +8,9 @@ from django.core.urlresolvers import reverse_lazy class Profile(models.Model): user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) available = models.NullBooleanField(blank=True) - bio = models.CharField(max_length=255, blank=True, null=True) - city = models.CharField(max_length=255, blank=True, null=True) - country = models.CharField(max_length=255, blank=True, null=True) - phone = models.CharField(max_length=255, blank=True, null=True) + bio = models.CharField(max_length=150, blank=True) + city = models.CharField(max_length=255, blank=True) + phone = models.CharField(max_length=255, blank=True) website = models.URLField(blank=True) def jabberID(self): -- GitLab