-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from LangCorrect/04-migrate-corrections
04 migrate corrections
- Loading branch information
Showing
15 changed files
with
575 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DATABASE_URL=postgres:///langcorrect | ||
CELERY_BROKER_URL=redis://127.0.0.1:6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
[ | ||
{ | ||
"model": "corrections.correctiontype", | ||
"pk": 1, | ||
"fields": { | ||
"created": "2023-07-12T01:02:18.866Z", | ||
"modified": "2023-07-12T01:02:18.866Z", | ||
"is_removed": false, | ||
"name": "Formatting and Citations", | ||
"description": "This correction type deals with issues related to the proper formatting of the document, including indentation, spacing, font styles, and citation styles. It aims to ensure adherence to standard writing conventions, citation guidelines, and any specific formatting requirements." | ||
} | ||
}, | ||
{ | ||
"model": "corrections.correctiontype", | ||
"pk": 2, | ||
"fields": { | ||
"created": "2023-07-12T01:03:20.975Z", | ||
"modified": "2023-07-12T01:03:20.975Z", | ||
"is_removed": false, | ||
"name": "Content and Development", | ||
"description": "This correction type involves evaluating the substance and development of ideas in the writing. It focuses on the relevance, coherence, and depth of the content, ensuring that ideas are well-supported, logical, and effectively communicated to engage the reader and convey the intended message." | ||
} | ||
}, | ||
{ | ||
"model": "corrections.correctiontype", | ||
"pk": 3, | ||
"fields": { | ||
"created": "2023-07-12T01:04:32.395Z", | ||
"modified": "2023-07-12T01:04:32.395Z", | ||
"is_removed": false, | ||
"name": "Style and Tone", | ||
"description": "This correction type focuses on refining the writing style, tone, and voice. It aims to create a consistent and appropriate tone throughout the writing, aligning it with the intended audience and purpose. This correction type may involve suggestions to enhance the writing's persuasiveness, formality, informality, or other stylistic aspects." | ||
} | ||
}, | ||
{ | ||
"model": "corrections.correctiontype", | ||
"pk": 4, | ||
"fields": { | ||
"created": "2023-07-12T01:05:44.944Z", | ||
"modified": "2023-07-12T01:05:44.944Z", | ||
"is_removed": false, | ||
"name": "Clarity and Coherence", | ||
"description": "This correction type aims to improve the overall clarity, logical flow, and organization of ideas in writing. It involves identifying and rectifying issues related to unclear or ambiguous expressions, lack of logical connections between ideas, or inconsistencies in paragraph organization to enhance the reader's understanding." | ||
} | ||
}, | ||
{ | ||
"model": "corrections.correctiontype", | ||
"pk": 5, | ||
"fields": { | ||
"created": "2023-07-12T01:06:46.076Z", | ||
"modified": "2023-07-12T01:06:46.076Z", | ||
"is_removed": false, | ||
"name": "Sentence Structure", | ||
"description": "This correction type focuses on analyzing and improving the structure of sentences. It involves addressing issues such as run-on sentences, sentence fragments, awkward phrasing, and inconsistencies in sentence construction to improve the overall flow and readability of the writing." | ||
} | ||
}, | ||
{ | ||
"model": "corrections.correctiontype", | ||
"pk": 6, | ||
"fields": { | ||
"created": "2023-07-12T01:07:38.225Z", | ||
"modified": "2023-07-12T01:07:38.225Z", | ||
"is_removed": false, | ||
"name": "Word Choice", | ||
"description": "This correction type involves suggesting alternatives or improvements for specific words or phrases used in the writing. It aims to enhance precision, clarity, and vocabulary richness by recommending more appropriate or effective words that convey the intended meaning more accurately." | ||
} | ||
}, | ||
{ | ||
"model": "corrections.correctiontype", | ||
"pk": 7, | ||
"fields": { | ||
"created": "2023-07-12T01:08:29.733Z", | ||
"modified": "2023-07-12T01:08:29.733Z", | ||
"is_removed": false, | ||
"name": "Capitalization", | ||
"description": "This correction type focuses on ensuring correct capitalization throughout the writing. It involves correcting errors related to the capitalization of proper nouns, sentence beginnings, titles, and other instances where capital letters should be more appropriately used." | ||
} | ||
}, | ||
{ | ||
"model": "corrections.correctiontype", | ||
"pk": 8, | ||
"fields": { | ||
"created": "2023-07-12T01:09:31.829Z", | ||
"modified": "2023-07-12T01:09:31.829Z", | ||
"is_removed": false, | ||
"name": "Punctuation", | ||
"description": "This correction type entails reviewing and correcting errors related to the proper use of punctuation marks. It includes fixing issues with commas, periods, question marks, exclamation marks, quotation marks, colons, semicolons, and other punctuation symbols to enhance readability and convey meaning effectively." | ||
} | ||
}, | ||
{ | ||
"model": "corrections.correctiontype", | ||
"pk": 9, | ||
"fields": { | ||
"created": "2023-07-12T01:10:24.955Z", | ||
"modified": "2023-07-12T01:10:24.955Z", | ||
"is_removed": false, | ||
"name": "Grammar", | ||
"description": "This correction type addresses errors in sentence structure and grammatical rules. It involves rectifying mistakes in verb tenses, subject-verb agreement, articles, pronouns, prepositions, and other grammatical elements to improve the overall accuracy and clarity of the writing." | ||
} | ||
}, | ||
{ | ||
"model": "corrections.correctiontype", | ||
"pk": 10, | ||
"fields": { | ||
"created": "2023-07-12T01:11:06.092Z", | ||
"modified": "2023-07-12T01:11:06.092Z", | ||
"is_removed": false, | ||
"name": "Spelling", | ||
"description": "This correction type focuses on identifying and correcting errors related to incorrect spelling. This correction type involves fixing mistakes in the spelling of words, ensuring proper usage of homophones, and correcting any typos or misspelled words" | ||
} | ||
} | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
from django.contrib import admin | ||
|
||
from langcorrect.corrections.models import CorrectedRow, CorrectionType, OverallFeedback, PerfectRow | ||
|
||
|
||
@admin.register(CorrectionType) | ||
class CorrectionTypeAdmin(admin.ModelAdmin): | ||
list_display = ["name", "description"] | ||
|
||
|
||
@admin.register(CorrectedRow) | ||
class CorrectedRowAdmin(admin.ModelAdmin): | ||
readonly_fields = ["post", "user", "post_row", "correction", "note", "correction_types"] | ||
list_display = ["author", "corrector", "original_sentence", "correction", "note", "get_correction_types"] | ||
search_fields = ["post__user__username"] | ||
|
||
def author(self, obj): | ||
if obj.post: | ||
return obj.post.user | ||
else: | ||
return None | ||
|
||
def corrector(self, obj): | ||
return obj.user | ||
|
||
def original_sentence(self, obj): | ||
return obj.post_row.sentence | ||
|
||
def get_correction_types(self, obj): | ||
return [t.name for t in obj.correction_types.all()] | ||
|
||
|
||
@admin.register(PerfectRow) | ||
class PerfectRowAdmin(admin.ModelAdmin): | ||
readonly_fields = ["post", "user", "post_row"] | ||
list_display = ["author", "corrector", "original_sentence"] | ||
search_fields = ["post__user__username"] | ||
|
||
def author(self, obj): | ||
if obj.post: | ||
return obj.post.user | ||
else: | ||
return None | ||
|
||
def corrector(self, obj): | ||
return obj.user | ||
|
||
def original_sentence(self, obj): | ||
return obj.post_row.sentence | ||
|
||
|
||
@admin.register(OverallFeedback) | ||
class OverallFeedbackAdmin(admin.ModelAdmin): | ||
readonly_fields = ["post", "user", "comment"] | ||
list_display = ["receiver", "corrector", "comment", "is_draft"] | ||
search_fields = ["post__user__username"] | ||
|
||
def receiver(self, obj): | ||
if obj.post: | ||
return obj.post.user | ||
else: | ||
return None | ||
|
||
def corrector(self, obj): | ||
return obj.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.apps import AppConfig | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
|
||
class CorrectionsConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "langcorrect.corrections" | ||
verbose_name = _("Corrections") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Generated by Django 4.2.3 on 2023-07-21 07:53 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import django.utils.timezone | ||
import model_utils.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
("posts", "0002_postrow"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="CorrectionType", | ||
fields=[ | ||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
( | ||
"created", | ||
model_utils.fields.AutoCreatedField( | ||
default=django.utils.timezone.now, editable=False, verbose_name="created" | ||
), | ||
), | ||
( | ||
"modified", | ||
model_utils.fields.AutoLastModifiedField( | ||
default=django.utils.timezone.now, editable=False, verbose_name="modified" | ||
), | ||
), | ||
("is_removed", models.BooleanField(default=False)), | ||
("name", models.CharField(max_length=100, unique=True)), | ||
("description", models.TextField()), | ||
], | ||
options={ | ||
"verbose_name": "Correction Type", | ||
"verbose_name_plural": "Correction Types", | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="CorrectedRow", | ||
fields=[ | ||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
( | ||
"created", | ||
model_utils.fields.AutoCreatedField( | ||
default=django.utils.timezone.now, editable=False, verbose_name="created" | ||
), | ||
), | ||
( | ||
"modified", | ||
model_utils.fields.AutoLastModifiedField( | ||
default=django.utils.timezone.now, editable=False, verbose_name="modified" | ||
), | ||
), | ||
("is_removed", models.BooleanField(default=False)), | ||
("correction", models.TextField()), | ||
("note", models.TextField(blank=True, default=None, null=True)), | ||
("correction_types", models.ManyToManyField(to="corrections.correctiontype")), | ||
( | ||
"post", | ||
models.ForeignKey( | ||
blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to="posts.post" | ||
), | ||
), | ||
("post_row", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="posts.postrow")), | ||
("user", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Generated by Django 4.2.3 on 2023-07-22 00:51 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import django.utils.timezone | ||
import model_utils.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("posts", "0002_postrow"), | ||
("corrections", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="PerfectRow", | ||
fields=[ | ||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
( | ||
"created", | ||
model_utils.fields.AutoCreatedField( | ||
default=django.utils.timezone.now, editable=False, verbose_name="created" | ||
), | ||
), | ||
( | ||
"modified", | ||
model_utils.fields.AutoLastModifiedField( | ||
default=django.utils.timezone.now, editable=False, verbose_name="modified" | ||
), | ||
), | ||
("is_removed", models.BooleanField(default=False)), | ||
( | ||
"post", | ||
models.ForeignKey( | ||
blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to="posts.post" | ||
), | ||
), | ||
("post_row", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="posts.postrow")), | ||
("user", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
] |
Oops, something went wrong.