mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-02 05:26:45 +00:00
Add 'Contact' model to Company app
This commit is contained in:
parent
f988c9af87
commit
feff4f0ddd
27
InvenTree/company/migrations/0005_contact.py
Normal file
27
InvenTree/company/migrations/0005_contact.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.12 on 2018-04-30 07:19
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('company', '0004_company_url'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Contact',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=100)),
|
||||||
|
('phone', models.CharField(blank=True, max_length=100)),
|
||||||
|
('email', models.EmailField(blank=True, max_length=254)),
|
||||||
|
('role', models.CharField(blank=True, max_length=100)),
|
||||||
|
('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contacts', to='company.Company')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
@ -65,3 +65,17 @@ class Company(models.Model):
|
|||||||
@property
|
@property
|
||||||
def has_parts(self):
|
def has_parts(self):
|
||||||
return self.part_count > 0
|
return self.part_count > 0
|
||||||
|
|
||||||
|
|
||||||
|
class Contact(models.Model):
|
||||||
|
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
|
||||||
|
phone = models.CharField(max_length=100, blank=True)
|
||||||
|
|
||||||
|
email = models.EmailField(blank=True)
|
||||||
|
|
||||||
|
role = models.CharField(max_length=100, blank=True)
|
||||||
|
|
||||||
|
company = models.ForeignKey(Company, related_name='contacts',
|
||||||
|
on_delete = models.CASCADE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user