forked from miguelramos/django-media-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
d91ad57
commit f8f5768
Showing
18 changed files
with
691 additions
and
2 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,3 +1,22 @@ | ||
*.pyc | ||
*.py[cod] | ||
.hgignore~ | ||
.gitignore~ | ||
.hg/ | ||
.hgtags | ||
.tox/ | ||
.travis.yml~ | ||
|
||
MANIFEST.in~ | ||
tmp/ | ||
.zip | ||
example/db/ | ||
example/tmp/ | ||
example/logs/ | ||
example/media/ | ||
example/static/ | ||
builddocs/ | ||
builddocs.zip | ||
build/ | ||
dist/ | ||
django_media_manager.egg-info/ | ||
django_media_manager.egg-info | ||
example/example/local_settings.py |
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,22 @@ | ||
syntax: regexp | ||
\.pyc$ | ||
\.hgignore~ | ||
\.gitignore~ | ||
\.git/ | ||
\.tox/ | ||
\.travis\.yml~ | ||
|
||
^MANIFEST\.in~ | ||
^tmp/ | ||
\.zip | ||
^example/media/ | ||
^example/db/ | ||
^example/tmp/ | ||
^example/logs/ | ||
^example/static/ | ||
^example/example/local_settings.py | ||
^builddocs/ | ||
^builddocs.zip | ||
^build/ | ||
^dist/ | ||
^django_media_manager\.egg-info |
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,73 @@ | ||
============================================ | ||
Example project for `django-dash` | ||
============================================ | ||
Follow instructions below to install the example project. Commands below are written for Ubuntu/Debian, | ||
but may work on other Linux distributions as well. | ||
|
||
- Create a new- or switch to existing- virtual environement. | ||
|
||
$ virtualenv dash | ||
|
||
$ source dash/bin/activate | ||
|
||
- Download the latest stable version of django-dash. | ||
|
||
$ wget https://github.com/barseghyanartur/django-dash/archive/stable.tar.gz | ||
|
||
- Unpack it somewhere. | ||
|
||
$ tar -xvf stable.tar.gz | ||
|
||
- Go to the unpacked directory. | ||
|
||
$ cd django-dash-stable | ||
|
||
- Install Django, requirements and finally django-dash. | ||
|
||
$ pip install Django | ||
|
||
$ pip install -r example/requirements.txt | ||
|
||
$ pip install -e git+https://github.com/barseghyanartur/django-dash@stable#egg=django-dash | ||
|
||
- Create some directories. | ||
|
||
$ mkdir example/media/ | ||
|
||
$ mkdir example/media/static/ | ||
|
||
$ mkdir example/static/ | ||
|
||
$ mkdir example/db/ | ||
|
||
- Copy local_settings.example | ||
|
||
$ cp example/example/local_settings.example example/example/local_settings.py | ||
|
||
- Run the commands to sync database, install test data and run the server. | ||
|
||
$ python example/example/manage.py syncdb --noinput --traceback -v 3 | ||
|
||
$ python example/example/manage.py migrate --noinput | ||
|
||
$ python example/example/manage.py collectstatic --noinput --traceback -v 3 | ||
|
||
$ python example/example/manage.py news_create_test_data --traceback -v 3 | ||
|
||
$ python example/example/manage.py dash_create_test_data --traceback -v 3 | ||
|
||
$ python example/example/manage.py runserver 0.0.0.0:8001 --traceback -v 3 | ||
|
||
- Open your browser and test the app. | ||
|
||
Dashboard: | ||
|
||
- URL: http://127.0.0.1:8001/dashboard/ | ||
- Admin username: test_admin | ||
- Admin password: test | ||
|
||
Django admin interface: | ||
|
||
- URL: http://127.0.0.1:8001/administration/ | ||
- Admin username: test_admin | ||
- Admin password: test |
Empty file.
Empty file.
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,59 @@ | ||
from django.contrib import admin | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
from foo.models import FooItem, Foo2Item, Foo3Item, Foo4Item | ||
|
||
|
||
class FooItemBaseAdmin(admin.ModelAdmin): | ||
""" | ||
Foo item admin. | ||
""" | ||
list_display = ('title', 'date_published') | ||
prepopulated_fields = {'slug': ('title',)} | ||
list_filter = ('date_published',) | ||
readonly_fields = ('date_created', 'date_updated',) | ||
|
||
fieldsets = ( | ||
(None, { | ||
'fields': ('title', 'slug', 'body',) | ||
}), | ||
(_("Publication date"), { | ||
'classes': ('',), | ||
'fields': ('date_published',) | ||
}), | ||
(_("Additional"), { | ||
'classes': ('collapse',), | ||
'fields': ('date_created', 'date_updated') #, | ||
}) | ||
) | ||
|
||
class Meta: | ||
app_label = _('Foo item') | ||
|
||
|
||
class FooItemAdmin(FooItemBaseAdmin): | ||
class Meta: | ||
app_label = _('Foo item') | ||
|
||
admin.site.register(FooItem, FooItemAdmin) | ||
|
||
|
||
class Foo2ItemAdmin(FooItemBaseAdmin): | ||
class Meta: | ||
app_label = _('Foo 2 item') | ||
|
||
admin.site.register(Foo2Item, Foo2ItemAdmin) | ||
|
||
|
||
class Foo3ItemAdmin(FooItemBaseAdmin): | ||
class Meta: | ||
app_label = _('Foo 3 item') | ||
|
||
admin.site.register(Foo3Item, Foo3ItemAdmin) | ||
|
||
|
||
class Foo4ItemAdmin(FooItemBaseAdmin): | ||
class Meta: | ||
app_label = _('Foo 4 item') | ||
|
||
admin.site.register(Foo4Item, Foo4ItemAdmin) |
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,45 @@ | ||
import datetime | ||
|
||
from django.db import models | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
from tinymce.models import HTMLField | ||
|
||
class FooItemBase(models.Model): | ||
""" | ||
Foo item base. | ||
""" | ||
title = models.CharField(_("Title"), max_length=100) | ||
slug = models.SlugField(_("Slug"), unique=True) | ||
body = HTMLField(_("Body")) | ||
date_published = models.DateTimeField(_("Date published"), blank=True, null=True, default=datetime.datetime.now()) | ||
date_created = models.DateTimeField(_("Date created"), blank=True, null=True, auto_now_add=True, editable=False) | ||
date_updated = models.DateTimeField(_("Date updated"), blank=True, null=True, auto_now=True, editable=False) | ||
|
||
class Meta: | ||
abstract = True | ||
verbose_name = _("Foo item") | ||
verbose_name_plural = _("Foo items") | ||
|
||
def __unicode__(self): | ||
return self.title | ||
|
||
class FooItem(FooItemBase): | ||
class Meta: | ||
verbose_name = _("Foo item") | ||
verbose_name_plural = _("Foo items") | ||
|
||
class Foo2Item(FooItemBase): | ||
class Meta: | ||
verbose_name = _("Foo 2 item") | ||
verbose_name_plural = _("Foo 2 items") | ||
|
||
class Foo3Item(FooItemBase): | ||
class Meta: | ||
verbose_name = _("Foo 3 item") | ||
verbose_name_plural = _("Foo 3 items") | ||
|
||
class Foo4Item(FooItemBase): | ||
class Meta: | ||
verbose_name = _("Foo 4 item") | ||
verbose_name_plural = _("Foo 4 items") |
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,25 @@ | ||
import os | ||
PROJECT_DIR = lambda base : os.path.abspath(os.path.join(os.path.dirname(__file__), base).replace('\\','/')) | ||
|
||
DEBUG = True | ||
DEBUG_TOOLBAR = not True | ||
TEMPLATE_DEBUG = DEBUG | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. | ||
'NAME': PROJECT_DIR('../db/example.db'), # Or path to database file if using sqlite3. | ||
# The following settings are not used with sqlite3: | ||
'USER': '', | ||
'PASSWORD': '', | ||
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. | ||
'PORT': '', # Set to empty string for default. | ||
} | ||
} | ||
|
||
INTERNAL_IPS = ('127.0.0.1',) | ||
|
||
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend' | ||
EMAIL_FILE_PATH = PROJECT_DIR('../tmp') | ||
|
||
DEFAULT_FROM_EMAIL = '<[email protected]>' |
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,10 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
|
||
if __name__ == "__main__": | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") | ||
|
||
from django.core.management import execute_from_command_line | ||
|
||
execute_from_command_line(sys.argv) |
Oops, something went wrong.