Skip to content

Commit

Permalink
bug(image): Add url field
Browse files Browse the repository at this point in the history
- Deprecate cloudinary field to use url field on profiles

[Starts #163974030]
  • Loading branch information
kwanj-k committed Feb 14, 2019
1 parent d2b433d commit 549e637
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
18 changes: 18 additions & 0 deletions authors/apps/profiles/migrations/0002_auto_20190214_1015.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.1.4 on 2019-02-14 10:15

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('profiles', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='userprofile',
name='image',
field=models.URLField(blank=True, null=True),
),
]
5 changes: 1 addition & 4 deletions authors/apps/profiles/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
from django.db import models
from django.db.models.signals import post_save

# Third-party imports
from cloudinary.models import CloudinaryField

# Local imports
from authors.apps.authentication.models import User
from authors.settings import AUTH_USER_MODEL
Expand All @@ -26,7 +23,7 @@ class UserProfile(models.Model):
user = models.OneToOneField(AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name='profiles')
image = CloudinaryField('image', default='')
image = models.URLField(blank=True,null=True)
bio = models.TextField(null=True, blank=True, max_length=255)
following = models.ManyToManyField(AUTH_USER_MODEL, blank=True,
related_name='followed_by')
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 ProfileSerialiazer(serializers.ModelSerializer):
username = serializers.CharField(source='user.username', read_only=True)
image = serializers.ImageField()
image = serializers.URLField(required=False)
following = serializers.SerializerMethodField()

def get_following(self, obj):
Expand Down

0 comments on commit 549e637

Please sign in to comment.