Форум сайта python.su
import fcgi
count=0
while fcgi.isFCGI():
request = fcgi.Accept()
request.out.write("Cache-control: no-cache")
request.out.write("Content-Type: text/plain\n\n")
request.out.write("python fastcgi example\n")
request.out.write("counter: "+str(count)+"\n")
count+=1
request.Finish();
import fcgi
count=0
while fcgi.isFCGI():
request = fcgi.Accept()
print "Content-Type: text/plain\n"
print "sgsdg"
request.Finish()
def __getattribute__(self, name):
check = object.__getattribute__(self, '_Proxy__check')
check()
PyObject* PyObject_RichCompare(PyObject *o1, PyObject *o2, int opid)
class Author(models.Model):
name = models.CharField(max_length=150)
surname = models.CharField(max_length=60)
def __unicode__(self):
return u'%s %s ' % (self.name, self.surname)
class Book(models.Model):
title = models.CharField(max_length=100)
author = models.ManyToManyField(Author)
price = models.DecimalField("", max_digits=7, decimal_places=2)
def get_entry_author(self):
entry = Book.objects.get(id='self.id')
return entry.authors.all()
get_entry_author.short_description = 'Author'
def __unicode__(self):
return u'%s ' % (self.title)
class BookAdmin(admin.ModelAdmin):
fieldsets = [
('Name book',{'fields': ['title']}),
('Publisher information', {'fields': ['publisher']}),
('Publication date', {'fields': ['publication_date']}),
('Price', {'fields': ['price']}),
('Author', {'fields': ['author']}),
]
list_display = ('title', 'publisher', 'publication_date','price', 'get_entry_author',)
list_filter = ['title']
date_hierarchy = 'publication_date'
class AuthorAdmin(admin.ModelAdmin):
fieldsets=[
('Author information',{'fields':('name', 'surname')}),
]
list_display = ('name', 'surname', )
admin.site.register(Book,BookAdmin)
admin.site.register(Author, AuthorAdmin)
def get_entry_author(self):
entry = Book.objects.get(id='self.id')
return entry.authors.all()
get_entry_author.short_description = 'Author'
#-*- coding:cp1251 -*-
from Tkinter import *
tk=Tk()
class app:
def act(self,event):
self.text.set(self.ent.get())
txt='test'
self.ent.insert(END,txt) # вставили то что нужно
self.ent.icursor(len(self.ent.get())-len(txt)) # поставили курсор до вставленного
self.ent.select_range(len(self.ent.get())-len(txt),END) #выделили вставленное
def __init__(self):
self.ent=Entry(tk)
self.ent.pack()
self.text=StringVar()
self.lab=Label(tk,textvariable=self.text)
self.lab.pack()
self.ent.bind('<KeyRelease>',self.act)
s=app()
tk.mainloop()
select * from users where users.id> (select max(id) from (select id from users limit(70)) as t) limit(20)
class pc(models.Model): name = models.CharField(max_length=30, unique=True) user = models.CharField(max_length=30) location = models.CharField(max_length=30) monitor = models.CharField(max_length=255) ups = models.CharField(max_length=255) cpu = models.CharField(max_length=255) om = models.CharField(max_length=255) hdd = models.CharField(max_length=255) date_create = models.DateField()