Skip to content

Commit

Permalink
Initial commit from Aldryn Blueprints
Browse files Browse the repository at this point in the history
  • Loading branch information
czpython committed Jun 17, 2017
0 parents commit f71aeae
Show file tree
Hide file tree
Showing 32 changed files with 2,192 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
*.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

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Complexity
output/*.html
output/*/index.html

# Sphinx
docs/build

*.lokalize
lokalize*

.idea
docs
*.sass-cache
*~

*.sqlite
*.sh

node_modules
12 changes: 12 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"preset": "crockford",

"maximumLineLength": {
"value": 120,
"allowRegex": true,
"allowUrlComments": true
},
"disallowQuotedKeysInObjects": null,
"requireMultipleVarDecl": null,
"disallowDanglingUnderscores": null
}
21 changes: 21 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"browser": true,
"esnext": true,
"expr": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 4,
"jquery": true,
"latedef": true,
"newcap": true,
"noarg": true,
"node": true,
"nonbsp": true,
"quotmark": "single",
"strict": true,
"unused": true,
"trailing": true
}
24 changes: 24 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2017, Divio AG
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Divio AG nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL DIVIO AG BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include LICENSE.txt
include README.rst
recursive-include djangocms_modules/templates *
recursive-exclude * *.py[co] .sass-cache
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==================
django CMS Modules
==================


Installation
============

* run ``pip install djangocms-modules``
* add ``'djangocms_modules'`` to your INSTALLED_APPS
* migrate your project: ``python manage.py migrate``
2 changes: 2 additions & 0 deletions djangocms_modules/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '0.0.1'
28 changes: 28 additions & 0 deletions djangocms_modules/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
from adminsortable2.admin import SortableAdminMixin
from django.contrib import admin
from parler.admin import TranslatableAdmin

from .models import Category, BlueprintPluginModel


class BlueprintAdminClass(SortableAdminMixin, TranslatableAdmin):
list_filter = ('category',)


class CategoryAdminClass(SortableAdminMixin, TranslatableAdmin):
"""Any admin options you need go here"""
enable_sorting = True

@property
def media(self):
from parler.admin import _fakeRequest, _language_prepopulated_media, _language_media
has_prepopulated = len(self.get_prepopulated_fields(_fakeRequest))
sortable = super(CategoryAdminClass, self).media
if has_prepopulated:
return sortable + _language_prepopulated_media
else: #NOQA
return sortable + _language_media

admin.site.register(Category, CategoryAdminClass)
admin.site.register(BlueprintPluginModel, BlueprintAdminClass)
Loading

0 comments on commit f71aeae

Please sign in to comment.