Skip to content

Commit

Permalink
upload to pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanMo committed May 17, 2016
1 parent ecbed19 commit 99a07b8
Show file tree
Hide file tree
Showing 23 changed files with 798 additions and 22 deletions.
8 changes: 1 addition & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@
快速开始:
---------

安装依赖模块:

.. code-block::
pip install xmltodict
安装wechat:

.. code-block::
pip install git+https://github.com/ChanMo/django_wechat.git
pip install django-wechat
把wechat模块添加到你的settings.py里面:

Expand Down
1 change: 1 addition & 0 deletions build/lib.linux-x86_64-2.7/wechat/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'wechat.apps.WechatConfig'
42 changes: 42 additions & 0 deletions build/lib.linux-x86_64-2.7/wechat/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import json

from django.contrib import admin
from . import models
from .models import Menu, Text, News
from django.conf.urls import patterns, include, url
from django.http import HttpResponse
from . import api


class MenuAdmin(admin.ModelAdmin):
list_display = ('top', 'name', 'type', 'value')

def get_urls(self):
urls = super(MenuAdmin, self).get_urls()
my_urls = [
url(r"^sync/$", self.sync_menu),
]
return my_urls + urls

def sync_menu(self, request):
menu_list = models.menu_list()
wx = api.Menu()
content = wx.sync_menu(menu_list)
return HttpResponse(json.dumps(content))

def get_form(self, request, obj=None, **kwargs):
form = super(MenuAdmin, self).get_form(request, obj, **kwargs)
form.base_fields['top'].queryset = Menu.objects.filter(top=None)
return form


class TextAdmin(admin.ModelAdmin):
list_display = ('keyword', 'content', 'updated')

class NewsAdmin(admin.ModelAdmin):
list_display = ('keyword', 'title', 'description', 'updated')


admin.site.register(Menu, MenuAdmin)
admin.site.register(Text, TextAdmin)
admin.site.register(News, NewsAdmin)

0 comments on commit 99a07b8

Please sign in to comment.