Made content field for note unlimited

This commit is contained in:
keannu125 2023-03-03 23:47:30 +08:00
parent ff7934407a
commit 428423c2cc
4 changed files with 22 additions and 3 deletions

View file

@ -5,8 +5,9 @@ from notes.models import Note
class CustomUserSerializer(serializers.ModelSerializer):
notes = serializers.PrimaryKeyRelatedField(
many=True, queryset=Note.objects.all())
many=True, allow_null=True, queryset=Note.objects.all())
class Meta:
model = User
fields = ['id', 'username', 'notes']
fields = ['id', 'username', 'notes',]
read_only_fields = ['id', 'notes']

Binary file not shown.

View file

@ -0,0 +1,18 @@
# Generated by Django 4.1.7 on 2023-03-03 15:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('notes', '0008_alter_note_owner'),
]
operations = [
migrations.AlterField(
model_name='note',
name='content',
field=models.TextField(),
),
]

View file

@ -7,7 +7,7 @@ User = get_user_model()
class Note(models.Model):
title = models.CharField(max_length=20)
content = models.CharField(max_length=1024)
content = models.TextField()
date_created = models.DateTimeField(default=now, editable=False)
owner = models.ForeignKey(User, on_delete=models.CASCADE)