Skip to content

Commit

Permalink
feat: On Project Creation, enable externally led
Browse files Browse the repository at this point in the history
fixes #25
  • Loading branch information
idabblewith committed Mar 1, 2024
1 parent 894e3ef commit b2b3b43
Show file tree
Hide file tree
Showing 20 changed files with 581 additions and 199 deletions.
2 changes: 1 addition & 1 deletion agencies/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

from django.db import migrations, models

Expand Down
2 changes: 1 addition & 1 deletion agencies/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

import django.db.models.deletion
from django.conf import settings
Expand Down
2 changes: 1 addition & 1 deletion categories/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

from django.db import migrations, models

Expand Down
2 changes: 1 addition & 1 deletion communications/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

from django.db import migrations, models

Expand Down
2 changes: 1 addition & 1 deletion communications/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

import django.db.models.deletion
from django.conf import settings
Expand Down
2 changes: 1 addition & 1 deletion contacts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

import django.db.models.deletion
from django.db import migrations, models
Expand Down
2 changes: 1 addition & 1 deletion contacts/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

import django.db.models.deletion
from django.conf import settings
Expand Down
6 changes: 1 addition & 5 deletions documents/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

import django.core.validators
from django.db import migrations, models
Expand Down Expand Up @@ -56,10 +56,6 @@ class Migration(migrations.Migration):
name='Endorsement',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('bm_endorsement_required', models.BooleanField(default=True, help_text='Whether Biometrician Endorsement is Required.')),
('bm_endorsement_provided', models.BooleanField(default=False, help_text="The Biometrician's endorsement of the methodology's statistical validity.")),
('hc_endorsement_required', models.BooleanField(default=False, help_text='Whether Herbarium Curator Endorsement is Required.')),
('hc_endorsement_provided', models.BooleanField(default=False, help_text="The Herbarium Curator's endorsement of the planned collection of voucher specimens.")),
('ae_endorsement_required', models.BooleanField(default=False, help_text='Whether Animal Ethics Committee Endorsement is Required.')),
('ae_endorsement_provided', models.BooleanField(default=False, help_text="The Animal Ethics Committee's endorsement of the planned direct interaction with animals. Approval process is currently handled outside of SPMS.")),
('no_specimens', models.TextField(blank=True, help_text="Estimate the number of collected vouchered specimens. Provide any additional info required for the Harbarium Curator's endorsement.", null=True)),
Expand Down
2 changes: 1 addition & 1 deletion documents/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

import django.db.models.deletion
from django.conf import settings
Expand Down
51 changes: 20 additions & 31 deletions documents/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class ConceptPlan(models.Model):
<td class="table-cell-light" style="border: 1px solid black; width: 175px; vertical-align: top; text-align: start;"></td>\
</tr>\
</tbody>\
</table>'
</table>',
# json.dumps(
# [
# ["Role", "Year 1", "Year 2", "Year 3"],
Expand Down Expand Up @@ -357,19 +357,18 @@ class ConceptPlan(models.Model):
<td class="table-cell-light" style="border: 1px solid black; width: 175px; vertical-align: top; text-align: start;"></td>\
</tr>\
</tbody>\
</table>'

</table>',
)

def extract_inner_text(self, html_string):
# Parse the HTML using BeautifulSoup
soup = BeautifulSoup(html_string, 'html.parser')
soup = BeautifulSoup(html_string, "html.parser")

# Extract the text content
inner_text = soup.get_text(separator=' ', strip=True)
inner_text = soup.get_text(separator=" ", strip=True)

return inner_text

def __str__(self) -> str:
title = self.document.project.title
title = self.extract_inner_text(title)
Expand Down Expand Up @@ -444,7 +443,6 @@ class ProjectPlan(models.Model):
help_text="Describe the study design and statistical analysis.",
)


operating_budget = models.TextField(
blank=True,
null=True,
Expand Down Expand Up @@ -550,8 +548,7 @@ class ProjectPlan(models.Model):
<td class="table-cell-light" style="border: 1px solid black; width: 175px; vertical-align: top; text-align: start;"></td>\
</tr>\
</tbody>\
</table>'

</table>',
# default=json.dumps(
# [
# ["Source", "Year 1", "Year 2", "Year 3"],
Expand Down Expand Up @@ -672,7 +669,7 @@ class ProjectPlan(models.Model):
<td class="table-cell-light" style="border: 1px solid black; width: 175px; vertical-align: top; text-align: start;"></td>\
</tr>\
</tbody>\
</table>'
</table>',
# default=json.dumps(
# [
# ["Source", "Year 1", "Year 2", "Year 3"],
Expand All @@ -694,7 +691,6 @@ class ProjectPlan(models.Model):
help_text="Name related SPPs and the extent you have consulted with their project leaders",
)


# involves_plants = models.BooleanField(
# default=False,
# help_text="Tick to indicate that this project will collect plant specimens, which will require endorsement by the Herbarium Curator.",
Expand All @@ -705,24 +701,22 @@ class ProjectPlan(models.Model):
# help_text="Tick to indicate that this project will involve direct interaction with animals, which will require endorsement by the Animal Ethics Committee.",
# )


def extract_inner_text(self, html_string):
# Parse the HTML using BeautifulSoup
soup = BeautifulSoup(html_string, 'html.parser')
soup = BeautifulSoup(html_string, "html.parser")

# Extract the text content
inner_text = soup.get_text(separator=' ', strip=True)
inner_text = soup.get_text(separator=" ", strip=True)

return inner_text

def __str__(self) -> str:
title = self.document.project.title
title = self.extract_inner_text(title)
if len(title) > 50:
title = title[:50] + "..."
return f"(PROJECT PLAN) {title}"


class Meta:
verbose_name = "Project Plan"
verbose_name_plural = "Project Plans"
Expand Down Expand Up @@ -792,15 +786,16 @@ class ProgressReport(models.Model):
null=True,
help_text="Future directions for the annual activity update. Aim for 100 to 150 words. One bullet point per direction.",
)

def extract_inner_text(self, html_string):
# Parse the HTML using BeautifulSoup
soup = BeautifulSoup(html_string, 'html.parser')
soup = BeautifulSoup(html_string, "html.parser")

# Extract the text content
inner_text = soup.get_text(separator=' ', strip=True)
inner_text = soup.get_text(separator=" ", strip=True)

return inner_text

def __str__(self) -> str:
title = self.document.project.title
title = self.extract_inner_text(title)
Expand Down Expand Up @@ -856,29 +851,26 @@ class StudentReport(models.Model):

def extract_inner_text(self, html_string):
# Parse the HTML using BeautifulSoup
soup = BeautifulSoup(html_string, 'html.parser')
soup = BeautifulSoup(html_string, "html.parser")

# Extract the text content
inner_text = soup.get_text(separator=' ', strip=True)
inner_text = soup.get_text(separator=" ", strip=True)

return inner_text

def __str__(self) -> str:
title = self.document.project.title
title = self.extract_inner_text(title)
if len(title) > 50:
title = title[:50] + "..."
return f"STUDENT REPORT ({self.year}) | {title}"


class Meta:
verbose_name = "Student Report"
verbose_name_plural = "Student Reports"
unique_together = ("report", "project")




# Done
class ProjectClosure(models.Model):
"""
Expand Down Expand Up @@ -949,21 +941,20 @@ class OutcomeChoices(models.TextChoices):

def extract_inner_text(self, html_string):
# Parse the HTML using BeautifulSoup
soup = BeautifulSoup(html_string, 'html.parser')
soup = BeautifulSoup(html_string, "html.parser")

# Extract the text content
inner_text = soup.get_text(separator=' ', strip=True)
inner_text = soup.get_text(separator=" ", strip=True)

return inner_text

def __str__(self) -> str:
title = self.document.project.title
title = self.extract_inner_text(title)
if len(title) > 50:
title = title[:50] + "..."
return f"(PROJECT CLOSURE) {title}"


class Meta:
verbose_name = "Project Closure"
verbose_name_plural = "Project Closures"
Expand Down Expand Up @@ -1044,8 +1035,6 @@ class EndorsementChoices(models.TextChoices):
help_text="Describe how and where data will be maintained, archived, cataloged. Read DBCA guideline 16.",
)



def __str__(self) -> str:
return f"ENDORSEMENTS - {self.project_plan}"

Expand Down
2 changes: 1 addition & 1 deletion locations/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

from django.db import migrations, models

Expand Down
2 changes: 1 addition & 1 deletion medias/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

from django.db import migrations, models

Expand Down
2 changes: 1 addition & 1 deletion medias/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

import django.db.models.deletion
from django.conf import settings
Expand Down
2 changes: 1 addition & 1 deletion projects/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

import django.contrib.postgres.fields
import django.db.models.deletion
Expand Down
2 changes: 1 addition & 1 deletion projects/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-03-01 05:30
# Generated by Django 5.0.2 on 2024-03-01 07:54

import django.db.models.deletion
from django.conf import settings
Expand Down
Loading

0 comments on commit b2b3b43

Please sign in to comment.