First version
This commit is contained in:
1
polyclinic_scheduling/apps/hospital/__init__.py
Normal file
1
polyclinic_scheduling/apps/hospital/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
default_app_config = 'apps.hospital.apps.HospitalConfig'
|
10
polyclinic_scheduling/apps/hospital/admin.py
Normal file
10
polyclinic_scheduling/apps/hospital/admin.py
Normal file
@ -0,0 +1,10 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Hospital
|
||||
|
||||
# Register your models here.
|
||||
@admin.register(Hospital)
|
||||
class HospitalAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'address', 'postal_code', 'city', 'phone', 'created_at')
|
||||
ordering = ('name', 'city', 'created_at','updated_at')
|
||||
search_fields = ('name', 'address','postal_code','city', 'phone')
|
8
polyclinic_scheduling/apps/hospital/apps.py
Normal file
8
polyclinic_scheduling/apps/hospital/apps.py
Normal file
@ -0,0 +1,8 @@
|
||||
from django.apps import AppConfig
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
class HospitalConfig(AppConfig):
|
||||
name = 'apps.hospital'
|
||||
label = 'hospital'
|
||||
verbose_name = _('Hospital')
|
||||
verbose_name_plural = _('Hospitals')
|
@ -0,0 +1,30 @@
|
||||
# Generated by Django 3.0.6 on 2020-05-13 13:33
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Hospital',
|
||||
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(help_text='The name of this hospital', max_length=200, verbose_name='Name')),
|
||||
('address', models.CharField(blank=True, help_text='The address of this hospital', max_length=200, verbose_name='Address')),
|
||||
('postal_code', models.CharField(blank=True, help_text='The postal code of this hospital', max_length=10, verbose_name='Postal code')),
|
||||
('city', models.CharField(blank=True, help_text='The city of this hospital', max_length=60, verbose_name='City')),
|
||||
('phone', models.CharField(blank=True, help_text='The general phone number of this hospital', max_length=18, verbose_name='Phone number')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
16
polyclinic_scheduling/apps/hospital/models.py
Normal file
16
polyclinic_scheduling/apps/hospital/models.py
Normal file
@ -0,0 +1,16 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from lib.models.base import MetaDataModel
|
||||
|
||||
# Create your models here.
|
||||
class Hospital(MetaDataModel):
|
||||
name = models.CharField(_('Name'), max_length=200, help_text=_('The name of this hospital'))
|
||||
address = models.CharField(_('Address'), max_length=200, blank=True, help_text=_('The address of this hospital'))
|
||||
postal_code = models.CharField(_('Postal code'), max_length=10, blank=True, help_text=_('The postal code of this hospital'))
|
||||
city = models.CharField(_('City'), max_length=60, blank=True, help_text=_('The city of this hospital'))
|
||||
phone = models.CharField(_('Phone number'), max_length=18, blank=True, help_text=_('The general phone number of this hospital'))
|
||||
|
||||
def __str__(self):
|
||||
"""str: Returns a readable name for the hospital. Format is [hospital_name] ([city])."""
|
||||
return '{}{}'.format(self.name, ('' if not self.city else ' ({})'.format(self.city)))
|
3
polyclinic_scheduling/apps/hospital/tests.py
Normal file
3
polyclinic_scheduling/apps/hospital/tests.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
3
polyclinic_scheduling/apps/hospital/views.py
Normal file
3
polyclinic_scheduling/apps/hospital/views.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
Reference in New Issue
Block a user