Просмотр исходного кода

Added draft models related to client, employee, project, invoice & representative

master
kj1352 3 лет назад
Родитель
Сommit
f392a19bfc
31 измененных файлов: 145 добавлений и 1 удалений
  1. +0
    -0
      client/__init__.py
  2. +3
    -0
      client/admin.py
  3. +6
    -0
      client/apps.py
  4. +9
    -0
      client/models.py
  5. +3
    -0
      client/tests.py
  6. +3
    -0
      client/views.py
  7. +0
    -0
      employee/__init__.py
  8. +3
    -0
      employee/admin.py
  9. +6
    -0
      employee/apps.py
  10. +16
    -0
      employee/models.py
  11. +3
    -0
      employee/tests.py
  12. +3
    -0
      employee/views.py
  13. +0
    -0
      invoice/__init__.py
  14. +3
    -0
      invoice/admin.py
  15. +6
    -0
      invoice/apps.py
  16. +13
    -0
      invoice/models.py
  17. +3
    -0
      invoice/tests.py
  18. +3
    -0
      invoice/views.py
  19. +0
    -0
      project/__init__.py
  20. +3
    -0
      project/admin.py
  21. +6
    -0
      project/apps.py
  22. +11
    -0
      project/models.py
  23. +3
    -0
      project/tests.py
  24. +3
    -0
      project/views.py
  25. +0
    -0
      representative/__init__.py
  26. +3
    -0
      representative/admin.py
  27. +6
    -0
      representative/apps.py
  28. +15
    -0
      representative/models.py
  29. +3
    -0
      representative/tests.py
  30. +3
    -0
      representative/views.py
  31. +6
    -1
      workx_backend/settings/base.py

+ 0
- 0
client/__init__.py Просмотреть файл


+ 3
- 0
client/admin.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.

+ 6
- 0
client/apps.py Просмотреть файл

@@ -0,0 +1,6 @@
from django.apps import AppConfig


class ClientConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'client'

+ 9
- 0
client/models.py Просмотреть файл

@@ -0,0 +1,9 @@
from django.db import models


class Client(models.Model):
name = models.CharField(max_length=30)
tax_id = models.CharField(max_length=30)

def __str__(self):
return self.name

+ 3
- 0
client/tests.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.

+ 3
- 0
client/views.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.

+ 0
- 0
employee/__init__.py Просмотреть файл


+ 3
- 0
employee/admin.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.

+ 6
- 0
employee/apps.py Просмотреть файл

@@ -0,0 +1,6 @@
from django.apps import AppConfig


class EmployeeConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'employee'

+ 16
- 0
employee/models.py Просмотреть файл

@@ -0,0 +1,16 @@
from django.contrib.auth.models import User
from django.db import models
from project.models import Project


class Employee(models.Model):
user = models.ForeignKey(User)
phone = models.CharField(max_length=15)
salary = models.FloatField()
emp_id = models.CharField(max_length=15)
start_date = models.DateField()
end_date = models.DateField(null=True, blank=True)
projects = models.ManyToManyField(Project)

def __str__(self):
return self.name

+ 3
- 0
employee/tests.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.

+ 3
- 0
employee/views.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.

+ 0
- 0
invoice/__init__.py Просмотреть файл


+ 3
- 0
invoice/admin.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.

+ 6
- 0
invoice/apps.py Просмотреть файл

@@ -0,0 +1,6 @@
from django.apps import AppConfig


class InvoiceConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'invoice'

+ 13
- 0
invoice/models.py Просмотреть файл

@@ -0,0 +1,13 @@
from django.db import models
from project.models import Project


class Invoice(models.Model):
project = models.ForeignKey(Project)
invoice_id = models.CharField(max_length=15)
raised_date = models.DateField()
due_date = models.DateField()
is_paid = models.BooleanField()

def __str__(self):
return self.invoice_id

+ 3
- 0
invoice/tests.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.

+ 3
- 0
invoice/views.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.

+ 0
- 0
project/__init__.py Просмотреть файл


+ 3
- 0
project/admin.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.

+ 6
- 0
project/apps.py Просмотреть файл

@@ -0,0 +1,6 @@
from django.apps import AppConfig


class ProjectConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'project'

+ 11
- 0
project/models.py Просмотреть файл

@@ -0,0 +1,11 @@
from django.db import models
from client.models import Client


class Project(models.Model):
name = models.CharField(max_length=30)
price = models.FloatField()
client = models.ForeignKey(Client)

def __str__(self):
return self.name

+ 3
- 0
project/tests.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.

+ 3
- 0
project/views.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.

+ 0
- 0
representative/__init__.py Просмотреть файл


+ 3
- 0
representative/admin.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.

+ 6
- 0
representative/apps.py Просмотреть файл

@@ -0,0 +1,6 @@
from django.apps import AppConfig


class RepresentativeConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'representative'

+ 15
- 0
representative/models.py Просмотреть файл

@@ -0,0 +1,15 @@
from django.contrib.auth.models import User
from django.db import models
from project.models import Project
from client.models import Client


class Representative(models.Model):
user = models.ForeignKey(User)
phone = models.CharField(max_length=15)
role = models.CharField(max_length=15)
projects = models.ManyToManyField(Project)
clients = models.ManyToManyField(Client)

def __str__(self):
return self.user.name

+ 3
- 0
representative/tests.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.

+ 3
- 0
representative/views.py Просмотреть файл

@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.

+ 6
- 1
workx_backend/settings/base.py Просмотреть файл

@@ -23,7 +23,12 @@ INSTALLED_APPS = [
'rest_framework',
'rest_framework.authtoken',
'drfpasswordless',
'drf_yasg'
'drf_yasg',
'client',
'employee',
'invoice',
'project',
'representative'
]

PASSWORDLESS_AUTH = {