-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create PronounSeries and Gender models; delete Pronoun model (#13)
Aside from some extra refactoring and reformatting, the other [semi-major] change is moving the `DocumentManager` class to its own file, `managers.py`.
- Loading branch information
Showing
9 changed files
with
320 additions
and
71 deletions.
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
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,11 @@ | ||
""" | ||
Custom managers for the gender analysis web app. | ||
""" | ||
from django.db import models | ||
|
||
|
||
class DocumentManager(models.Manager): | ||
def create_document(self, **attributes): | ||
doc = self.create(**attributes) | ||
doc.get_tokenized_text_wc_and_pos() | ||
return doc |
37 changes: 37 additions & 0 deletions
37
backend/app/migrations/0003_pronounseries_gender_models.py
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,37 @@ | ||
# Generated by Django 3.1.5 on 2021-06-25 17:10 | ||
|
||
import app.fields | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('app', '0002_document'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='PronounSeries', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('identifier', models.CharField(max_length=60)), | ||
('obj', app.fields.LowercaseCharField(max_length=40)), | ||
('pos_det', app.fields.LowercaseCharField(max_length=40)), | ||
('pos_pro', app.fields.LowercaseCharField(max_length=40)), | ||
('reflex', app.fields.LowercaseCharField(max_length=40)), | ||
('subj', app.fields.LowercaseCharField(max_length=40)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Gender', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('label', models.CharField(max_length=60)), | ||
('pronoun_series', models.ManyToManyField(to='app.PronounSeries')), | ||
], | ||
), | ||
migrations.DeleteModel( | ||
name='Pronoun', | ||
), | ||
] |
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,14 @@ | ||
# Generated by Django 3.1.5 on 2021-06-25 17:22 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('app', '0004_auto_20210623_1831'), | ||
('app', '0003_pronounseries_gender_models'), | ||
] | ||
|
||
operations = [ | ||
] |
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
Oops, something went wrong.