mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Compare commits
1 Commits
aa51ce7861
...
feature/su
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee948381b1 |
@@ -46,6 +46,7 @@ INSTALLED_APPS = (
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'RIGS',
|
||||
'subhire',
|
||||
|
||||
'debug_toolbar',
|
||||
'registration',
|
||||
|
||||
0
subhire/__init__.py
Normal file
0
subhire/__init__.py
Normal file
6
subhire/admin.py
Normal file
6
subhire/admin.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.contrib import admin
|
||||
import models
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(models.Hire)
|
||||
admin.site.register(models.Provider)
|
||||
43
subhire/migrations/0001_initial.py
Normal file
43
subhire/migrations/0001_initial.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Hire',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('name', models.CharField(max_length=255)),
|
||||
('description', models.TextField(null=True, blank=True)),
|
||||
('start_date', models.DateField()),
|
||||
('end_date', models.DateField()),
|
||||
('start_transport', models.IntegerField(blank=True, null=True, choices=[(0, b'TEC Transport'), (1, b'Provider Transports')])),
|
||||
('mic', models.ForeignKey(related_name='hire_mic', verbose_name=b'MIC', blank=True, to=settings.AUTH_USER_MODEL, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Provider',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('name', models.CharField(max_length=50)),
|
||||
('phone', models.CharField(max_length=15, null=True, blank=True)),
|
||||
('email', models.EmailField(max_length=254, null=True, blank=True)),
|
||||
('address', models.TextField(null=True, blank=True)),
|
||||
('notes', models.TextField(null=True, blank=True)),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='hire',
|
||||
name='provider',
|
||||
field=models.ForeignKey(blank=True, to='subhire.Provider', null=True),
|
||||
),
|
||||
]
|
||||
0
subhire/migrations/__init__.py
Normal file
0
subhire/migrations/__init__.py
Normal file
39
subhire/models.py
Normal file
39
subhire/models.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import reversion
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
# Create your models here.
|
||||
class Hire(models.Model):
|
||||
WE_TRANSPORT = 0
|
||||
THEY_TRANSPORT = 1
|
||||
TRANSPORT_CHOICES = (
|
||||
(WE_TRANSPORT, 'TEC Transport'),
|
||||
(THEY_TRANSPORT, 'Provider Transports'),
|
||||
)
|
||||
|
||||
name = models.CharField(max_length=255)
|
||||
description = models.TextField(blank=True, null=True)
|
||||
provider = models.ForeignKey('Provider', blank=True, null=True)
|
||||
|
||||
start_date = models.DateField()
|
||||
end_date = models.DateField()
|
||||
|
||||
start_transport = models.IntegerField(
|
||||
choices=TRANSPORT_CHOICES, blank=True, null=True)
|
||||
|
||||
mic = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='hire_mic', blank=True, null=True,
|
||||
verbose_name="MIC")
|
||||
|
||||
class Provider(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
phone = models.CharField(max_length=15, blank=True, null=True)
|
||||
email = models.EmailField(blank=True, null=True)
|
||||
|
||||
address = models.TextField(blank=True, null=True)
|
||||
|
||||
notes = models.TextField(blank=True, null=True)
|
||||
|
||||
@property
|
||||
def latest_hires(self):
|
||||
return self.hire_set.order_by('-start_date').select_related()
|
||||
3
subhire/tests.py
Normal file
3
subhire/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
subhire/views.py
Normal file
3
subhire/views.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Reference in New Issue
Block a user