mirror of
https://github.com/lemeow125/Django-NotesApp.git
synced 2024-11-17 06:29:25 +08:00
Made content field for note unlimited
This commit is contained in:
parent
ff7934407a
commit
428423c2cc
4 changed files with 22 additions and 3 deletions
|
@ -5,8 +5,9 @@ from notes.models import Note
|
||||||
|
|
||||||
class CustomUserSerializer(serializers.ModelSerializer):
|
class CustomUserSerializer(serializers.ModelSerializer):
|
||||||
notes = serializers.PrimaryKeyRelatedField(
|
notes = serializers.PrimaryKeyRelatedField(
|
||||||
many=True, queryset=Note.objects.all())
|
many=True, allow_null=True, queryset=Note.objects.all())
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
fields = ['id', 'username', 'notes']
|
fields = ['id', 'username', 'notes',]
|
||||||
|
read_only_fields = ['id', 'notes']
|
||||||
|
|
Binary file not shown.
18
project/notes/migrations/0009_alter_note_content.py
Normal file
18
project/notes/migrations/0009_alter_note_content.py
Normal 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(),
|
||||||
|
),
|
||||||
|
]
|
|
@ -7,7 +7,7 @@ User = get_user_model()
|
||||||
|
|
||||||
class Note(models.Model):
|
class Note(models.Model):
|
||||||
title = models.CharField(max_length=20)
|
title = models.CharField(max_length=20)
|
||||||
content = models.CharField(max_length=1024)
|
content = models.TextField()
|
||||||
date_created = models.DateTimeField(default=now, editable=False)
|
date_created = models.DateTimeField(default=now, editable=False)
|
||||||
owner = models.ForeignKey(User, on_delete=models.CASCADE)
|
owner = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue