Skip to content

Commit

Permalink
Add professional_background model
Browse files Browse the repository at this point in the history
  • Loading branch information
achintyanath authored and ayu023ban committed May 28, 2022
1 parent cb7090f commit f9f738a
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 0 deletions.
1 change: 1 addition & 0 deletions admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'Event',
'Interest',
'AdministrativePosition',
'ProfessionalBackground',
'Membership',
'Book',
'Paper',
Expand Down
36 changes: 36 additions & 0 deletions migrations/0022_professionalbackground.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by Django 3.2.8 on 2022-05-24 06:46

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.KERNEL_FACULTYMEMBER_MODEL),
('faculty_biodata', '0021_auto_20210502_0253'),
]

operations = [
migrations.CreateModel(
name='ProfessionalBackground',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('datetime_created', models.DateTimeField(auto_now_add=True)),
('datetime_modified', models.DateTimeField(auto_now=True)),
('start_date', models.DateField()),
('end_date', models.DateField(blank=True, null=True)),
('is_full_date', models.BooleanField(default=False)),
('position', models.CharField(max_length=127)),
('organisation', models.CharField(max_length=127)),
('description', models.TextField(blank=True)),
('priority', models.IntegerField(default=0)),
('visibility', models.BooleanField(default=True)),
('faculty_member', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.KERNEL_FACULTYMEMBER_MODEL)),
],
options={
'swappable': 'FACULTY_BIODATA_PROFESSIONALBACKGROUND_MODEL',
},
),
]
3 changes: 3 additions & 0 deletions models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
from faculty_biodata.models.engagements.positions.administration import (
AdministrativePosition,
)
from faculty_biodata.models.engagements.positions.professional import (
ProfessionalBackground,
)

# Events
from faculty_biodata.models.events.event import (
Expand Down
3 changes: 3 additions & 0 deletions models/engagements/positions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
from faculty_biodata.models.engagements.positions.administration import (
AdministrativePosition,
)
from faculty_biodata.models.engagements.positions.professional import (
ProfessionalBackground,
)
29 changes: 29 additions & 0 deletions models/engagements/positions/professional.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import swapper
from django.db import models

from common_biodata.models import AbstractPosition
from faculty_biodata.models.abstract_classes.base_model import BaseModel


class ProfessionalBackground(AbstractPosition, BaseModel):
"""
This model contains information about professional background of a
faculty member
"""

class Meta:
"""
Meta class for ProfessionalBackground
"""

swappable = swapper.swappable_setting('faculty_biodata','ProfessionalBackground')

def __str__(self):
"""
Return the string representation of the model
:return: the string representation of the model
"""

faculty_member = self.faculty_member
string = super().__str__()
return f'{faculty_member}: {string}'

0 comments on commit f9f738a

Please sign in to comment.