Skip to content

Commit

Permalink
* Add the Category model to the Project app. This allows Documents to…
Browse files Browse the repository at this point in the history
… be associated with a category.

* Rebuild the initial migration.
  • Loading branch information
bgroff committed Apr 5, 2017
1 parent 8a4303b commit 469569d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
6 changes: 3 additions & 3 deletions django_kala/accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-17 04:14
# Generated by Django 1.11 on 2017-04-05 00:23
from __future__ import unicode_literals

import django.contrib.auth.models
Expand Down Expand Up @@ -35,7 +35,7 @@ class Migration(migrations.Migration):
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, unique=True)),
('uuid', models.UUIDField(db_index=True, default=uuid.uuid4, unique=True)),
('title', models.CharField(blank=True, max_length=255, null=True)),
('timezone', timezone_field.fields.TimeZoneField(blank=True, default='UTC')),
('access_new_projects', models.BooleanField(default=False)),
Expand All @@ -53,8 +53,8 @@ class Migration(migrations.Migration):
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
],
options={
'db_table': 'kala_person',
'ordering': ['first_name', 'last_name'],
'db_table': 'kala_person',
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
Expand Down
4 changes: 2 additions & 2 deletions django_kala/companies/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-17 04:14
# Generated by Django 1.11 on 2017-04-05 00:23
from __future__ import unicode_literals

from django.db import migrations, models
Expand Down Expand Up @@ -38,8 +38,8 @@ class Migration(migrations.Migration):
('is_active', models.BooleanField(default=True)),
],
options={
'db_table': 'kala_companies',
'ordering': ['name'],
'db_table': 'kala_companies',
},
),
]
6 changes: 3 additions & 3 deletions django_kala/documents/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-17 04:14
# Generated by Django 1.11 on 2017-04-05 00:23
from __future__ import unicode_literals

from django.conf import settings
Expand Down Expand Up @@ -30,8 +30,8 @@ class Migration(migrations.Migration):
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='projects.Project')),
],
options={
'db_table': 'kala_documents',
'ordering': ['-date', 'name'],
'db_table': 'kala_documents',
},
),
migrations.CreateModel(
Expand All @@ -48,9 +48,9 @@ class Migration(migrations.Migration):
('person', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['name', 'created'],
'get_latest_by': 'created',
'db_table': 'kala_document_version',
'ordering': ['name', 'created'],
},
),
]
19 changes: 16 additions & 3 deletions django_kala/projects/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-17 04:14
# Generated by Django 1.11 on 2017-04-05 00:23
from __future__ import unicode_literals

from django.conf import settings
Expand All @@ -12,11 +12,19 @@ class Migration(migrations.Migration):
initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('companies', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('type', models.CharField(db_index=True, max_length=20)),
],
),
migrations.CreateModel(
name='Project',
fields=[
Expand All @@ -30,8 +38,13 @@ class Migration(migrations.Migration):
('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='companies.Company')),
],
options={
'db_table': 'kala_projects',
'ordering': ('name',),
'db_table': 'kala_projects',
},
),
migrations.AddField(
model_name='category',
name='project',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='projects.Project'),
),
]
9 changes: 9 additions & 0 deletions django_kala/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ def remove_client(self, client):

def __str__(self):
return self.name


class Category(models.Model):
name = models.CharField(max_length=255)
project = models.ForeignKey(Project)
type = models.CharField(max_length=20, db_index=True)

def __str__(self):
return '{0} - {1}'.format(self.name, self.type)

0 comments on commit 469569d

Please sign in to comment.