foonpcf 最近的时间轴更新
foonpcf

foonpcf

V2EX 第 22752 号会员,加入于 2012-06-28 11:18:17 +08:00
Django 及 Html 的兩者關係
Python  •  foonpcf  •  2015-06-09 20:54:30 PM  •  最后回复来自 zjxubinbin
14
有什麼方法可以檢查網頁用什麼語言來開發呢?
问与答  •  foonpcf  •  2014-11-25 15:10:55 PM  •  最后回复来自 foonpcf
4
請問題怎樣才能不透過 SSH 連線 Mysql Server?
问与答  •  foonpcf  •  2014-08-18 09:32:48 AM  •  最后回复来自 cdffh
6
像淘宝一樣的搜尋引擎
问与答  •  foonpcf  •  2014-09-25 10:13:05 AM  •  最后回复来自 huanghaofu86
10
Python calendar 問題.
Python  •  foonpcf  •  2014-05-19 22:18:59 PM  •  最后回复来自 foonpcf
2
請問大家有沒有一些簽學生到系統原碼?
问与答  •  foonpcf  •  2014-01-14 23:40:28 PM  •  最后回复来自 Sunyanzi
5
Django有沒有一些簽到系統?
Django  •  foonpcf  •  2015-05-21 09:55:16 AM  •  最后回复来自 tanteng
1
請問,有沒有一些線上報名系可以整合在網站內?
问与答  •  foonpcf  •  2014-01-07 22:02:57 PM  •  最后回复来自 foonpcf
8
foonpcf 最近回复了
2016-05-28 08:52:08 +08:00
回复了 zmrenwu 创建的主题 Python Django 学习小组: Blog 开发实战项目与教程发布了。
支持
2014-11-25 15:10:55 +08:00
回复了 foonpcf 创建的主题 问与答 有什麼方法可以檢查網頁用什麼語言來開發呢?
謝謝 =)
2014-09-09 11:06:47 +08:00
回复了 F2Sky 创建的主题 iOS iOS 8 一出来你会第一时间升级么?
立即升級
2014-08-18 00:29:49 +08:00
回复了 foonpcf 创建的主题 问与答 請問題怎樣才能不透過 SSH 連線 Mysql Server?
謝謝你們的建議。
因為我正在開發Django項目,所以期望能不透過SSH能連接另一個機的SQL server。
2014-08-17 18:33:11 +08:00
回复了 foonpcf 创建的主题 问与答 請問題怎樣才能不透過 SSH 連線 Mysql Server?
因我用Sequel Pro.
它用必需要我輸入 SSH HOST,User及密碼才可連接。
2014-06-28 10:36:37 +08:00
回复了 foonpcf 创建的主题 问与答 像淘宝一樣的搜尋引擎
@YouXia 可以理用jQuery, 做到這些分詞和倒排索引?
2014-06-28 10:35:23 +08:00
回复了 foonpcf 创建的主题 问与答 像淘宝一樣的搜尋引擎
@em70 我的數據庫不大,只是大約5000本書籍。
2014-06-27 08:54:49 +08:00
回复了 foonpcf 创建的主题 问与答 像淘宝一樣的搜尋引擎
只是想有一些選擇,然後能夠過濾,這個功能
2014-05-19 22:18:59 +08:00
回复了 foonpcf 创建的主题 Python Python calendar 問題.
@MasterYoda 試許我貼一貼整段代碼

from __future__ import with_statement
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from models import Event
from django.utils.translation import ugettext as _
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse

from calendar import HTMLCalendar, TimeEncoding, month_name, day_abbr

from django.utils.dates import MONTHS
from django.utils.dates import WEEKDAYS_ABBR

from datetime import date
from itertools import groupby

from django.utils.html import conditional_escape as esc

import locale

class EventCalendar(HTMLCalendar):
"""http://journal.uggedal.com/creating-a-flexible-monthly-calendar-in-django"""
def __init__(self, events):
super(EventCalendar, self).__init__()
self.events = self.group_by_day(events)

def formatday(self, day, weekday):
if day != 0:
cssclass = self.cssclasses[weekday]
if date.today() == date(self.year, self.month, day):
cssclass += ' today'
body = '<a class="tipsy" href="#" title="%s">%d</a>' % (_('Today'), day)
if day in self.events:
d = reverse('events_day', args=[self.year, self.month, day])
body = '<a class="tipsy" href="%s" title="%s">%d</a>' % (d, _("Events found"), day)
return self.day_cell(cssclass, body)

if day in self.events:
cssclass += ' filled'
title = ['<ul class=event>']
for event in self.events[day]:
title.append('<li><b>%s</b></li>' % esc(event.name))
title.append('</ul>')
d = reverse('events_day', args=(self.year, self.month, day))
body = '<a class="tipsy" href="%s" title="%s">%d</a>' % (d, _("Events found"), day)
return self.day_cell(cssclass, body)
return self.day_cell(cssclass, day)
return self.day_cell('noday', '&nbsp;')

def formatweekday(self, day):
return '<th class="%s">%s</th>' % (self.cssclasses[day], WEEKDAYS_ABBR[day].title())

def formatmonthname(self, theyear, themonth, withyear=True):
if withyear:
s = '%s %s' % (MONTHS[themonth].title(), theyear)
else:
s = '%s' % MONTHS[themonth].title()
return '<tr><th colspan="7" class="month">%s</th></tr>' % s

def formatmonth(self, year, month):
self.year, self.month = year, month
return super(EventCalendar, self).formatmonth(year, month)

def group_by_day(self, events):
field = lambda event: event.start.day
return dict(
[(day, list(items)) for day, items in groupby(events, field)]
)

def day_cell(self, cssclass, body):
return '<td class="%s">%s</td>' % (cssclass, body)


class CMSCalendarEventsPlugin(CMSPluginBase):

name = _("Calendar Events")
render_template = "simple_events/events_calendar.html"

def render(self, context, instance, placeholder):
today = date.today()
year = today.year
month = today.month

request = context['request']
if request.GET:
month = int(request.GET.get('month') or month)
year = int(request.GET.get('year') or year)
first_day = date(year,month,1)
if month == 12:
last_day = date(year+1,1,1)
else:
last_day = date(year,month+1,1)
events = Event.objects.filter(start__gte=first_day).filter(start__lt=last_day)
cal = EventCalendar(events).formatmonth(year, month)
context.update({'instance':instance,
'events': events,
'calendar': mark_safe(cal),
'placeholder':placeholder})
return context

plugin_pool.register_plugin(CMSCalendarEventsPlugin)
2014-03-31 14:59:25 +08:00
回复了 jeffery 创建的主题 程序员 求问 Web 编程应该如何快速入门?
@h1994st 反而好奇當遇到有壓力項目,怎樣產生動力呢?我往往遇到這個情況,總是會逃避。然後就.........一拖再拖....
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2815 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 19ms · UTC 02:16 · PVG 10:16 · LAX 19:16 · JFK 22:16
Developed with CodeLauncher
♥ Do have faith in what you're doing.