-
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
e7a4ae8
commit 254bed3
Showing
102 changed files
with
1,219 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,8 @@ | ||
from django.contrib import admin | ||
from article.models import * | ||
|
||
# Register your models here. | ||
class ArticleAdmin(admin.ModelAdmin): | ||
list_display = ('id','title','author','publish_date','visible') | ||
|
||
admin.site.register(Article,ArticleAdmin) |
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,54 @@ | ||
#-*- coding:UTF-8 -*- | ||
from article.models import * | ||
import xadmin | ||
from xadmin import views | ||
from xadmin.layout import Main, TabHolder, Tab, Fieldset, Row, Col, AppendedText, Side | ||
from xadmin.plugins.inline import Inline | ||
from xadmin.plugins.batch import BatchChangeAction | ||
|
||
|
||
class MainDashboard(object): | ||
widgets = [ | ||
[ | ||
{"type": "html", "title": "Notice", "content": "<h3> Welcome to Xadmin! </h3><p>this is html text</p>"}, | ||
# {"type": "chart", "model": "app.accessrecord", 'chart': 'user_count', 'params': {'_p_date__gte': '2013-01-08', 'p': 1, '_p_date__lt': '2013-01-29'}}, | ||
{"type": "list", "model": "cmdb.device", 'params': {'o':'-uptime'}}, | ||
], | ||
[ | ||
{"type": "qbutton", "title": "Quick Start", "btns": [{'model': Article}, {'model':Article}, {'title': "Google", 'url': "http://www.google.com"}]}, | ||
{"type": "addform", "model": Article}, | ||
] | ||
] | ||
xadmin.site.register(views.website.IndexView, MainDashboard) | ||
|
||
|
||
class BaseSetting(object): | ||
enable_themes = True | ||
use_bootswatch = True | ||
xadmin.site.register(views.BaseAdminView, BaseSetting) | ||
|
||
|
||
class GlobalSetting(object): | ||
#global_search_models = [Host, IDC] | ||
# global_models_icon = { | ||
# MemoStaff:'fa fa-user' | ||
# } | ||
menu_style = 'accordion' | ||
site_title = '物志' | ||
# def get_site_menu(self): | ||
# return ({'title':'友情链接', 'menus':( | ||
# {'title':'百度','url':'test'}, | ||
# )}, | ||
# ) | ||
xadmin.site.register(views.CommAdminView, GlobalSetting) | ||
|
||
class ArticleAdminx(object): | ||
list_display = ('id','title','author','publish_date') | ||
list_display_links = ('title',) | ||
list_editable = ['tag'] | ||
|
||
search_fields = ['title','detail','tag'] | ||
relfield_style = 'fk-ajax' | ||
reversion_enable = True | ||
xadmin.site.register(Article,ArticleAdminx) | ||
|
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,31 @@ | ||
# Generated by Django 2.0.2 on 2018-02-23 14:08 | ||
|
||
from django.db import migrations, models | ||
import tinymce.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Article', | ||
fields=[ | ||
('id', models.AutoField(primary_key=True, serialize=False)), | ||
('author', models.CharField(default='小志', max_length=128)), | ||
('publish_date', models.DateTimeField(auto_now_add=True)), | ||
('title', models.CharField(max_length=1024)), | ||
('detail', tinymce.models.HTMLField()), | ||
('tag', models.CharField(blank=True, max_length=128, null=True)), | ||
('readtime', models.IntegerField(default=0)), | ||
], | ||
options={ | ||
'db_table': 'articles', | ||
'ordering': ['-publish_date'], | ||
}, | ||
), | ||
] |
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 @@ | ||
# Generated by Django 2.0.2 on 2018-02-23 14:54 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('article', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='article', | ||
name='visible', | ||
field=models.CharField(choices=[('Y', '是'), ('N', '否')], default='N', max_length=64), | ||
), | ||
] |
Binary file not shown.
Binary file not shown.
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,29 @@ | ||
# coding=utf-8 | ||
from django.db import models | ||
from tinymce.models import HTMLField | ||
#from tagging.fields import TagField | ||
#from tagging.models import Tag | ||
|
||
# Create your models here. | ||
|
||
class Article(models.Model): | ||
id=models.AutoField(primary_key=True) | ||
#catalog=models.ForeignKey(Catalogs) | ||
author = models.CharField(max_length=128,default='小志') | ||
publish_date = models.DateTimeField(auto_now_add=True) | ||
title = models.CharField(max_length=1024) | ||
detail = HTMLField() | ||
tag = models.CharField(max_length=128, blank=True, null=True) | ||
visible = models.CharField(choices=((u'Y',u'是'),(u'N',u'否')),max_length=64,default='N') | ||
readtime = models.IntegerField(default=0) | ||
|
||
def set_tags(self, tags): | ||
Tag.objects.update_tags(self, tags) | ||
def get_tags(self, tags): | ||
return Tag.objects.get_for_object(self) | ||
def __unicode__(self): | ||
return self.title | ||
class Meta: | ||
db_table ="articles" | ||
ordering = ['-publish_date'] | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
This is where language files should be placed. | ||
|
||
Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/ |
Oops, something went wrong.