Skip to content

Commit

Permalink
feat: adding image_link field to model
Browse files Browse the repository at this point in the history
  • Loading branch information
ebauschatz committed Sep 23, 2022
1 parent cede755 commit b9cf6c5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
18 changes: 18 additions & 0 deletions products/migrations/0002_product_image_link.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.1 on 2022-09-23 16:54

from django.db import migrations, models


class Migration(migrations.Migration):

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

operations = [
migrations.AddField(
model_name='product',
name='image_link',
field=models.CharField(max_length=1000, null=True),
),
]
3 changes: 2 additions & 1 deletion products/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ class Product(models.Model):
title = models.CharField(max_length=255)
description = models.CharField(max_length=255)
price = models.DecimalField(max_digits=9, decimal_places=2)
inventory_quantity = models.IntegerField()
inventory_quantity = models.IntegerField()
image_link = models.CharField(max_length=1000, null=True)
2 changes: 1 addition & 1 deletion products/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
class ProductSerializer(serializers.ModelSerializer):
class Meta:
model = Product
fields = ['id', 'title', 'description', 'price', 'inventory_quantity']
fields = ['id', 'title', 'description', 'price', 'inventory_quantity', 'image_link']

0 comments on commit b9cf6c5

Please sign in to comment.