fix: resolved changes

This commit is contained in:
NarayanBavisetti 2023-11-16 14:19:06 +05:30
parent cd8f1eb952
commit 71de47496a
4 changed files with 9 additions and 8 deletions

View File

@ -98,7 +98,7 @@ class SubPageSerializer(BaseSerializer):
try:
page = Page.objects.get(pk=obj.entity_identifier)
return PageSerializer(page).data
except Page.name:
except Page.DoesNotExist:
return None
return None

View File

@ -19,9 +19,9 @@ class Migration(migrations.Migration):
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')),
('updated_at', models.DateTimeField(auto_now=True, verbose_name='Last Modified At')),
('id', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('transaction', models.UUIDField(null=True)),
('transaction', models.UUIDField(default=uuid.uuid4)),
('entity_identifier', models.UUIDField(null=True)),
('entity_name', models.CharField(choices=[('to_do', 'To Do'), ('issue', 'issue'), ('image', 'Image'), ('video', 'Video'), ('file', 'File'), ('link', 'Link'), ('cycle', 'Cycle'), ('module', 'Module'), ('back_link', 'Back Link'), ('forward_link', 'Forward Link'), ('mention', 'Mention')], default='to_do', max_length=30, verbose_name='Transaction Type')),
('entity_name', models.CharField(choices=[('to_do', 'To Do'), ('issue', 'issue'), ('image', 'Image'), ('video', 'Video'), ('file', 'File'), ('link', 'Link'), ('cycle', 'Cycle'), ('module', 'Module'), ('back_link', 'Back Link'), ('forward_link', 'Forward Link'), ('mention', 'Mention')], max_length=30, verbose_name='Transaction Type')),
('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_created_by', to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='page_log', to='db.page')),
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='project_%(class)s', to='db.project')),
@ -49,6 +49,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='page',
name='parent',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='parent_page', to='db.page'),
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='child_page', to='db.page'),
),
]

View File

@ -18,7 +18,7 @@ def update_pages(apps, schema_editor):
# looping through all the pages
for page in Page.objects.all():
page_blocks = PageBlock.objects.filter(
page=page.id, project_id=page.project_id, workspace_id=page.workspace_id
page_id=page.id, project_id=page.project_id, workspace_id=page.workspace_id
).order_by("sort_order")
if page_blocks:

View File

@ -1,3 +1,5 @@
import uuid
# Django imports
from django.db import models
from django.conf import settings
@ -27,7 +29,7 @@ class Page(ProjectBaseModel):
on_delete=models.CASCADE,
null=True,
blank=True,
related_name="parent_page",
related_name="child_page",
)
archived_at = models.DateField(null=True)
is_locked = models.BooleanField(default=False)
@ -57,7 +59,7 @@ class PageLog(ProjectBaseModel):
("forward_link", "Forward Link"),
("mention", "Mention"),
)
transaction = models.UUIDField(null=True)
transaction = models.UUIDField(default=uuid.uuid4)
page = models.ForeignKey(
Page, related_name="page_log", on_delete=models.CASCADE
)
@ -66,7 +68,6 @@ class PageLog(ProjectBaseModel):
max_length=30,
choices=TYPE_CHOICES,
verbose_name="Transaction Type",
default="to_do",
)
class Meta: