Skip to content

Commit

Permalink
Merge pull request #39 from andela/bg-fix-image-link-error-164132638
Browse files Browse the repository at this point in the history
#164132638 Accept image URL
  • Loading branch information
d-kahara committed Feb 23, 2019
2 parents 27cfd08 + 1048b31 commit 02dcca7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
18 changes: 18 additions & 0 deletions authors/apps/profiles/migrations/0025_auto_20190218_0551.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.1.5 on 2019-02-18 05:51

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('profiles', '0024_auto_20190125_0803'),
]

operations = [
migrations.AlterField(
model_name='userprofile',
name='profile_image',
field=models.URLField(blank=True),
),
]
18 changes: 18 additions & 0 deletions authors/apps/profiles/migrations/0026_auto_20190218_0635.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.1.5 on 2019-02-18 06:35

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('profiles', '0025_auto_20190218_0551'),
]

operations = [
migrations.AlterField(
model_name='userprofile',
name='profile_image',
field=models.URLField(blank=True, default='https://d1nhio0ox7pgb.cloudfront.net/_img/o_collection_png/green_dark_grey/512x512/plain/user.png'),
),
]
2 changes: 1 addition & 1 deletion authors/apps/profiles/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class UserProfile(models.Model):
max_length=10, choices=gender_choices, default='N')

# cloudinary field
profile_image = CloudinaryField('image', blank=True)
profile_image = models.URLField(blank=True,default='https://d1nhio0ox7pgb.cloudfront.net/_img/o_collection_png/green_dark_grey/512x512/plain/user.png')

# A char field for the First name
first_name = models.CharField(max_length=100, blank=True)
Expand Down
2 changes: 1 addition & 1 deletion authors/apps/profiles/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class UserProfileSerializer(serializers.ModelSerializer):
"""
Class to serialize user profile data
"""
profile_image = serializers.ImageField(default=None)
profile_image = serializers.URLField(required=False)
gender = serializers.RegexField(
regex='^(N|F|M)$',
error_messages={
Expand Down

0 comments on commit 02dcca7

Please sign in to comment.