.
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
# Generated by Django 5.0.2 on 2024-10-14 15:29
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('atlas', '0062_alter_casecollection_markers'),
|
||||||
|
('oef', '0005_entry_inactive'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='Specialty',
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='formats',
|
||||||
|
name='specialties',
|
||||||
|
field=models.ManyToManyField(blank=True, to='atlas.subspecialty'),
|
||||||
|
),
|
||||||
|
]
|
||||||
+3
-7
@@ -1,6 +1,8 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
|
from atlas.models import Subspecialty
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class Entry(models.Model):
|
class Entry(models.Model):
|
||||||
modality = models.CharField(max_length=200)
|
modality = models.CharField(max_length=200)
|
||||||
@@ -39,7 +41,7 @@ class Formats(models.Model):
|
|||||||
|
|
||||||
inherits = models.ForeignKey('self', on_delete=models.CASCADE, null=True, blank=True)
|
inherits = models.ForeignKey('self', on_delete=models.CASCADE, null=True, blank=True)
|
||||||
|
|
||||||
specialties = models.ManyToManyField('Specialty', blank=True)
|
specialties = models.ManyToManyField(Subspecialty, blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
@@ -67,9 +69,3 @@ class Formats(models.Model):
|
|||||||
|
|
||||||
def get_entries(self):
|
def get_entries(self):
|
||||||
return Entry.objects.filter(questions__icontains=self.get_format(), inactive=False)
|
return Entry.objects.filter(questions__icontains=self.get_format(), inactive=False)
|
||||||
|
|
||||||
class Specialty(models.Model):
|
|
||||||
name = models.CharField(max_length=200)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.name
|
|
||||||
+1
-1
@@ -99,7 +99,7 @@ def format_search(request):
|
|||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
search = request.POST.get("search")
|
search = request.POST.get("search")
|
||||||
|
|
||||||
entries = Entry.objects.filter(questions__icontains=search)
|
entries = Entry.objects.filter(questions__icontains=search, inactive=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user