-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from mlebreuil/develop
Develop
- Loading branch information
Showing
44 changed files
with
1,343 additions
and
651 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[flake8] | ||
max-line-length = 120 | ||
extend-ignore = W504,E501 | ||
exclude = | ||
.git, | ||
__pycache__, | ||
build, | ||
dist | ||
max-complexity = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: double-quote-string-fixer | ||
- repo: https://github.com/ambv/black | ||
rev: 23.11.0 | ||
hooks: | ||
- id: black | ||
language_version: python3.10 | ||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 6.1.0 | ||
hooks: | ||
- id: flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
from django.core.exceptions import ObjectDoesNotExist | ||
from django.contrib.contenttypes.models import ContentType | ||
from netbox_contract.models import ContractAssignement, Contract | ||
from django.core.exceptions import ObjectDoesNotExist | ||
|
||
from netbox_contract.models import Contract, ContractAssignement | ||
|
||
for contract in Contract.objects.all(): | ||
circuits = contract.circuit.all() | ||
for circuit in circuits: | ||
try : | ||
try: | ||
circuit_type = ContentType.objects.get_for_model(circuit).id | ||
assignement = ContractAssignement.objects.get(content_type=circuit_type, object_id= circuit.id, contract__id=contract.id) | ||
assignement = ContractAssignement.objects.get( | ||
content_type=circuit_type, | ||
object_id=circuit.id, | ||
contract__id=contract.id, | ||
) | ||
except ObjectDoesNotExist: | ||
assignement = ContractAssignement(content_object=circuit, contract=contract) | ||
assignement.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[project] | ||
name = "netbox-contract" | ||
version = "2.0.8" | ||
version = "2.0.9" | ||
authors = [ | ||
{ name="Marc Lebreuil", email="[email protected]" }, | ||
] | ||
|
@@ -30,4 +30,10 @@ zip-safe = false | |
[tool.setuptools.packages.find] | ||
where = ["src"] | ||
include = ["*"] | ||
namespaces = false | ||
namespaces = false | ||
|
||
[tool.black] | ||
skip-string-normalization = true | ||
|
||
[tool.isort] | ||
profile = "black" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from setuptools import find_packages, setup | ||
from setuptools import setup | ||
|
||
setup() | ||
setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
from extras.plugins import PluginConfig | ||
|
||
|
||
class ContractsConfig(PluginConfig): | ||
name = 'netbox_contract' | ||
verbose_name = 'Netbox contract' | ||
description = 'Contract management plugin for Netbox' | ||
version = '2.0.8' | ||
version = '2.0.9' | ||
author = 'Marc Lebreuil' | ||
author_email = '[email protected]' | ||
base_url = 'contracts' | ||
min_version = "3.5.0" | ||
min_version = '3.5.0' | ||
required_settings = [] | ||
default_settings = { | ||
'top_level_menu': False, | ||
'default_accounting_dimensions': { | ||
'account': '', | ||
'project': '', | ||
'cost center': '', | ||
}, | ||
} | ||
|
||
|
||
config = ContractsConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from netbox.api.routers import NetBoxRouter | ||
|
||
from . import views | ||
|
||
app_name = 'netbox_contract' | ||
|
Oops, something went wrong.