Skip to content

Commit

Permalink
Reworked model such that the block_document/order tuple is unique
Browse files Browse the repository at this point in the history
  • Loading branch information
ni-sauvage committed Mar 2, 2023
1 parent 570c964 commit 23ba78c
Show file tree
Hide file tree
Showing 27 changed files with 31 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/node_modules
/node_modules
/env
Binary file added api/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added api/__pycache__/admin.cpython-310.pyc
Binary file not shown.
Binary file added api/__pycache__/apps.cpython-310.pyc
Binary file not shown.
Binary file added api/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file added api/__pycache__/serializers.cpython-310.pyc
Binary file not shown.
Binary file added api/__pycache__/spellcheck.cpython-310.pyc
Binary file not shown.
Binary file added api/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file added api/__pycache__/views.cpython-310.pyc
Binary file not shown.
17 changes: 17 additions & 0 deletions api/migrations/0004_alter_block_unique_together.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.1.5 on 2023-03-02 14:27

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('api', '0003_block_block_order'),
]

operations = [
migrations.AlterUniqueTogether(
name='block',
unique_together={('block_document', 'block_order')},
),
]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added api/migrations/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
5 changes: 4 additions & 1 deletion api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ class Block(models.Model):
The text content of a block.
"""

block_order = models.IntegerField(default=0, unique=True)
block_order = models.IntegerField(default=0)
"""
The index of a block within a document.
"""

created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now_add=True)

class Meta:
unique_together = ['block_document', 'block_order']

def __str__(self):
return self.block_content

Expand Down
Binary file added client/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added client/__pycache__/admin.cpython-310.pyc
Binary file not shown.
Binary file added client/__pycache__/apps.cpython-310.pyc
Binary file not shown.
Binary file added client/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file added client/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file added client/__pycache__/views.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file added server/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added server/__pycache__/settings.cpython-310.pyc
Binary file not shown.
Binary file added server/__pycache__/urls.cpython-310.pyc
Binary file not shown.
8 changes: 8 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mkdir -p static/client/js
touch static/client/js/main.js
cd docker
sudo docker-compose build
sudo docker-compose up -d webserver
sudo docker-compose exec -T webserver bash -c '. scripts/install.sh; python3 manage.py test'
sudo rm -rf ../static
sudo docker-compose down

0 comments on commit 23ba78c

Please sign in to comment.