First version
This commit is contained in:
1
polyclinic_scheduling/apps/polyclinic/__init__.py
Normal file
1
polyclinic_scheduling/apps/polyclinic/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
default_app_config = 'apps.polyclinic.apps.PolyclinicConfig'
|
10
polyclinic_scheduling/apps/polyclinic/admin.py
Normal file
10
polyclinic_scheduling/apps/polyclinic/admin.py
Normal file
@ -0,0 +1,10 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Polyclinic
|
||||
|
||||
# Register your models here.
|
||||
@admin.register(Polyclinic)
|
||||
class PolyclinicAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'phone', 'created_at')
|
||||
ordering = ('name', 'created_at','updated_at')
|
||||
search_fields = ('name', 'phone')
|
8
polyclinic_scheduling/apps/polyclinic/apps.py
Normal file
8
polyclinic_scheduling/apps/polyclinic/apps.py
Normal file
@ -0,0 +1,8 @@
|
||||
from django.apps import AppConfig
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
class PolyclinicConfig(AppConfig):
|
||||
name = 'apps.polyclinic'
|
||||
label = 'polyclinic'
|
||||
verbose_name = _('Polyclinic')
|
||||
verbose_name_plural = _('Polyclinics')
|
@ -0,0 +1,30 @@
|
||||
# Generated by Django 3.0.6 on 2020-05-13 13:33
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('hospital', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Polyclinic',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True, help_text='The date and time this model has been created', verbose_name='Date created')),
|
||||
('updated_at', models.DateTimeField(auto_now=True, help_text='The date and time this model has been updated', verbose_name='Date updated')),
|
||||
('name', models.CharField(blank=True, help_text='The name of this polyclinic', max_length=200, verbose_name='Name')),
|
||||
('phone', models.CharField(blank=True, help_text='The general/direct phone number of this polyclinic', max_length=18, verbose_name='Phone number')),
|
||||
('hospital', models.ForeignKey(help_text='To which hospital belongs this polyclinic', on_delete=django.db.models.deletion.CASCADE, to='hospital.Hospital')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
15
polyclinic_scheduling/apps/polyclinic/models.py
Normal file
15
polyclinic_scheduling/apps/polyclinic/models.py
Normal file
@ -0,0 +1,15 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from lib.models.base import MetaDataModel
|
||||
from apps.hospital.models import Hospital
|
||||
# Create your models here.
|
||||
|
||||
class Polyclinic(MetaDataModel):
|
||||
hospital = models.ForeignKey(Hospital, on_delete=models.CASCADE, help_text=_('To which hospital belongs this polyclinic'))
|
||||
name = models.CharField(_('Name'), max_length=200, blank=True, help_text=_('The name of this polyclinic'))
|
||||
phone = models.CharField(_('Phone number'), max_length=18, blank=True, help_text=_('The general/direct phone number of this polyclinic'))
|
||||
|
||||
def __str__(self):
|
||||
"""str: Returns a readable name for the hospital. Format is [hospital_name] ([city])."""
|
||||
return '{} ({})'.format(self.name, self.hospital)
|
3
polyclinic_scheduling/apps/polyclinic/tests.py
Normal file
3
polyclinic_scheduling/apps/polyclinic/tests.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
3
polyclinic_scheduling/apps/polyclinic/views.py
Normal file
3
polyclinic_scheduling/apps/polyclinic/views.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
Reference in New Issue
Block a user