diff --git a/.gitignore b/.gitignore index 72364f99fe..f3d001706f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,6 @@ __pycache__/ *.py[cod] *$py.class -# C extensions -*.so - # Distribution / packaging .Python env/ @@ -24,66 +21,9 @@ var/ .installed.cfg *.egg -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover -.hypothesis/ - -# Translations -*.mo -*.pot # Django stuff: *.log local_settings.py - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# IPython Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# dotenv -.env - -# virtualenv -venv/ -ENV/ - -# Spyder project settings -.spyderproject - -# Rope project settings -.ropeproject +*.sqlite3 +**/migrations/* diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 2a38a73d64..ec07615606 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -37,6 +37,8 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + + 'part.apps.PartConfig' ] MIDDLEWARE = [ diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index e5d9cda725..c49507de99 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -13,9 +13,10 @@ Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ -from django.conf.urls import url +from django.conf.urls import url, include from django.contrib import admin urlpatterns = [ + url(r'^part/', include('part.urls')), url(r'^admin/', admin.site.urls), ] diff --git a/InvenTree/part/__init__.py b/InvenTree/part/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/InvenTree/part/admin.py b/InvenTree/part/admin.py new file mode 100644 index 0000000000..6499b85853 --- /dev/null +++ b/InvenTree/part/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin + +from .models import PartCategory + +admin.site.register(PartCategory) diff --git a/InvenTree/part/apps.py b/InvenTree/part/apps.py new file mode 100644 index 0000000000..43f6429c19 --- /dev/null +++ b/InvenTree/part/apps.py @@ -0,0 +1,7 @@ +from __future__ import unicode_literals + +from django.apps import AppConfig + + +class PartConfig(AppConfig): + name = 'part' diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py new file mode 100644 index 0000000000..cbefc602d1 --- /dev/null +++ b/InvenTree/part/models.py @@ -0,0 +1,14 @@ +from __future__ import unicode_literals + +from django.db import models + +class PartCategory(models.Model): + name = models.CharField(max_length=128) + description = models.CharField(max_length=512) + parent = models.ForeignKey('self', on_delete=models.CASCADE, blank=True, null=True) + + def __str__(self): + if self.parent: + return str(self.parent) + "/" + self.name + else: + return self.name \ No newline at end of file diff --git a/InvenTree/part/tests.py b/InvenTree/part/tests.py new file mode 100644 index 0000000000..7ce503c2dd --- /dev/null +++ b/InvenTree/part/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/InvenTree/part/urls.py b/InvenTree/part/urls.py new file mode 100644 index 0000000000..59e5d723c9 --- /dev/null +++ b/InvenTree/part/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls import url + +from . import views + +urlpatterns = [ + url(r'^$', views.index, name='index') +] \ No newline at end of file diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py new file mode 100644 index 0000000000..197afdb84c --- /dev/null +++ b/InvenTree/part/views.py @@ -0,0 +1,5 @@ +from django.shortcuts import render +from django.http import HttpResponse + +def index(request): + return HttpResponse("Hello world. This is the parts page")