Commit 2178adf4 authored by Ilham Maulana's avatar Ilham Maulana 💻

fix: shifting category field from ManyToManyRel to OneToOneField

parent f00cdc0f
# Generated by Django 5.0.7 on 2024-07-16 05:45
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('book', '0006_alter_book_category'),
]
operations = [
migrations.RemoveField(
model_name='book',
name='category',
),
migrations.AddField(
model_name='book',
name='category',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='book.category'),
),
]
......@@ -21,7 +21,9 @@ class Book(models.Model):
isbn = models.CharField(max_length=15, default="xxxxxxxxx-x")
description = models.CharField(max_length=255, blank=True, null=True)
cover_image = models.ImageField(upload_to="uploads", blank=True, null=True)
category = models.ManyToManyField(Category, blank=True, null=True)
category = models.OneToOneField(
Category, on_delete=models.SET_NULL, blank=True, null=True
)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment