Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,620 additions
and
4 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 |
---|---|---|
@@ -1,4 +1,43 @@ | ||
*.log | ||
*.pot | ||
*.pyc | ||
local_settings.py | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Packages | ||
*.egg | ||
*.egg-info | ||
dist | ||
build | ||
eggs | ||
parts | ||
bin | ||
var | ||
sdist | ||
develop-eggs | ||
.installed.cfg | ||
lib | ||
lib64 | ||
|
||
# Installer logs | ||
pip-log.txt | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
.tox | ||
nosetests.xml | ||
|
||
# Translations | ||
*.mo | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
.idea | ||
|
||
# dev db | ||
*.sqlite | ||
*.sqlite3 | ||
|
||
# sphinx | ||
docs/_build |
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,21 @@ | ||
django-ctt | ||
========== | ||
|
||
Copyright (C) Hiddendata | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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 @@ | ||
from core import register |
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,35 @@ | ||
#!/usr/bin/env python | ||
#-*- coding: utf-8 -*- | ||
#vim: set ts=4 sw=4 et fdm=marker : */ | ||
from django.db import models | ||
|
||
|
||
class TreePathModel(models.Model): | ||
# ancestor = models.ForeignKey('Node', related_name='tpa') | ||
# descendant = models.ForeignKey('Node', related_name='tpd') | ||
path_len = models.IntegerField() | ||
|
||
class Meta: | ||
unique_together = ('ancestor', 'descendant') | ||
abstract = True | ||
|
||
def __unicode__(self): | ||
return '%s -> %s (%d)' % (self.ancestor, self.descendant, self.path_len) | ||
|
||
|
||
def register(cls): | ||
""" | ||
generuje TreePathModel dla podanego modelu | ||
:param cls: | ||
:return: | ||
""" | ||
tpcls = type(cls.__name__ + 'TreePath', | ||
(TreePathModel,), | ||
{'__module__': cls.__module__}) | ||
ancestor_field = models.ForeignKey(cls, related_name='tpa') | ||
descendant_field = models.ForeignKey(cls, related_name='tpd') | ||
ancestor_field.contribute_to_class(tpcls, 'ancestor') | ||
descendant_field.contribute_to_class(tpcls, 'descendant') | ||
cls._tpm = tpcls | ||
cls._cls = cls | ||
return tpcls |
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,20 @@ | ||
#!/usr/bin/env python | ||
#-*- coding: utf-8 -*- | ||
#vim: set ts=4 sw=4 et fdm=marker : */ | ||
import functools | ||
|
||
|
||
def filtered_qs(func): | ||
""" | ||
#TODO: zrobić, obsługę funkcji z argumentami | ||
:param func: | ||
:return: | ||
""" | ||
|
||
@functools.wraps(func) | ||
def wrapped(self, *args, **kwargs): | ||
ret_qs = func(self) | ||
return ret_qs.filter(*args, **kwargs) | ||
|
||
return wrapped | ||
|
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,3 @@ | ||
#!/usr/bin/env python | ||
#-*- coding: utf-8 -*- | ||
#vim: set ts=4 sw=4 et fdm=marker : */ |
Oops, something went wrong.