add osusers app

This commit is contained in:
Jan Dittberner 2014-05-24 21:28:33 +02:00
parent d5e1128ff6
commit 1082128f22
8 changed files with 139 additions and 0 deletions

View file

@ -219,6 +219,7 @@ DJANGO_APPS = (
# Apps specific for this project go here.
LOCAL_APPS = (
'osusers',
'managemails',
)

View file

View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View file

@ -0,0 +1,98 @@
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Group'
db.create_table(u'osusers_group', (
('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)),
('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)),
('groupname', self.gf('django.db.models.fields.CharField')(unique=True, max_length=16)),
('gid', self.gf('django.db.models.fields.PositiveSmallIntegerField')(unique=True, primary_key=True)),
('descr', self.gf('django.db.models.fields.TextField')(blank=True)),
('passwd', self.gf('django.db.models.fields.CharField')(max_length=128, blank=True)),
))
db.send_create_signal(u'osusers', ['Group'])
# Adding model 'User'
db.create_table(u'osusers_user', (
('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)),
('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)),
('username', self.gf('django.db.models.fields.CharField')(unique=True, max_length=64)),
('uid', self.gf('django.db.models.fields.PositiveSmallIntegerField')(unique=True, primary_key=True)),
('group', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['osusers.Group'])),
('gecos', self.gf('django.db.models.fields.CharField')(max_length=128, blank=True)),
('homedir', self.gf('django.db.models.fields.CharField')(max_length=256)),
('shell', self.gf('django.db.models.fields.CharField')(max_length=64)),
))
db.send_create_signal(u'osusers', ['User'])
# Adding model 'Shadow'
db.create_table(u'osusers_shadow', (
('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)),
('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)),
('user', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['osusers.User'], unique=True, primary_key=True)),
('passwd', self.gf('django.db.models.fields.CharField')(max_length=128)),
('changedays', self.gf('django.db.models.fields.PositiveSmallIntegerField')(null=True, blank=True)),
('minage', self.gf('django.db.models.fields.PositiveSmallIntegerField')(null=True, blank=True)),
('maxage', self.gf('django.db.models.fields.PositiveSmallIntegerField')(null=True, blank=True)),
('gracedays', self.gf('django.db.models.fields.PositiveSmallIntegerField')(null=True, blank=True)),
('inactdays', self.gf('django.db.models.fields.PositiveSmallIntegerField')(null=True, blank=True)),
('expiredays', self.gf('django.db.models.fields.PositiveSmallIntegerField')(default=None, null=True, blank=True)),
))
db.send_create_signal(u'osusers', ['Shadow'])
def backwards(self, orm):
# Deleting model 'Group'
db.delete_table(u'osusers_group')
# Deleting model 'User'
db.delete_table(u'osusers_user')
# Deleting model 'Shadow'
db.delete_table(u'osusers_shadow')
models = {
u'osusers.group': {
'Meta': {'object_name': 'Group'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'descr': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'gid': ('django.db.models.fields.PositiveSmallIntegerField', [], {'unique': 'True', 'primary_key': 'True'}),
'groupname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '16'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'passwd': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'})
},
u'osusers.shadow': {
'Meta': {'object_name': 'Shadow'},
'changedays': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'expiredays': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
'gracedays': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'inactdays': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'maxage': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'minage': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'passwd': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['osusers.User']", 'unique': 'True', 'primary_key': 'True'})
},
u'osusers.user': {
'Meta': {'object_name': 'User'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'gecos': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'group': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['osusers.Group']"}),
'homedir': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'shell': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
'uid': ('django.db.models.fields.PositiveSmallIntegerField', [], {'unique': 'True', 'primary_key': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'})
}
}
complete_apps = ['osusers']

View file

@ -0,0 +1,31 @@
from django.db import models
from model_utils.models import TimeStampedModel
class Group(TimeStampedModel, models.Model):
groupname = models.CharField(max_length=16, unique=True)
gid = models.PositiveSmallIntegerField(unique=True, primary_key=True)
descr = models.TextField(blank=True)
passwd = models.CharField(max_length=128, blank=True)
class User(TimeStampedModel, models.Model):
username = models.CharField(max_length=64, unique=True)
uid = models.PositiveSmallIntegerField(unique=True, primary_key=True)
group = models.ForeignKey(Group)
gecos = models.CharField(max_length=128, blank=True)
homedir = models.CharField(max_length=256)
shell = models.CharField(max_length=64)
class Shadow(TimeStampedModel, models.Model):
user = models.OneToOneField(User, primary_key=True)
passwd = models.CharField(max_length=128)
changedays = models.PositiveSmallIntegerField(blank=True, null=True)
minage = models.PositiveSmallIntegerField(blank=True, null=True)
maxage = models.PositiveSmallIntegerField(blank=True, null=True)
gracedays = models.PositiveSmallIntegerField(blank=True, null=True)
inactdays = models.PositiveSmallIntegerField(blank=True, null=True)
expiredays = models.PositiveSmallIntegerField(blank=True, null=True,
default=None)

View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View file

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.