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
>>> user[0].set_password(new_password) | |
>>> user[0].check_password(new_password) | |
False | |
>>> u = user[0] | |
>>> u.set_password(new_password) | |
>>> u.check_password(new_password) | |
True |
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
Report.objects.get(form=instance.form) # находит объект | |
ReportCounter.objects.get(report=Report.objects.get(form=instance.form)) # возвращает DoesNotExist: Report matching query does not exist | |
# при этом такой запрос | |
ReportCounter.objects.filter(report=Report.objects.get(form=instance.form)).values()) # -> | |
# [{'report_id': 0L, u'id': 255L, 'datetime': datetime.datetime(2014, 9, 3, 13, 54, 10, tzinfo=<UTC>)} | |
# 'report_id': 0L меня очень смущает. | |
# Models: | |
class Form(models.Model): | |
name = models.CharField(max_length=200) |
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
{ | |
"data": { | |
"checkboxes": [ | |
{ | |
"preferences": { | |
"cheetos": { | |
"describe": { | |
"Count": 20.0, | |
"First Quartile (Q1)": 0.0, | |
"Max": 1.0, |
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
class User(AbstractUser): | |
""" | |
An user. | |
# Create some users | |
>>> admin = User.objects.create(username="iamadmin") | |
>>> admin.groups.add('admin') | |
>>> staff = User.objects.create(username="iamstaff") | |
>>> staff.groups.add('staff') | |
>>> staff.curators.add(admin) |
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
# Django settings for curvelurve_server project. | |
from os.path import realpath | |
import os | |
PROJECT_PATH = realpath(os.path.join(os.path.dirname(__file__), '..')) | |
MEDIA_ROOT = realpath(os.path.join(PROJECT_PATH, '..', 'public', "media")) | |
MEDIA_URL = '' | |
# STATIC_ROOT = realpath(os.path.join(PROJECT_PATH, '..', 'public', 'static')) | |
STATIC_URL = '/static/' | |
STATICFILES_DIRS = (('', realpath(os.path.join(PROJECT_PATH, '..', 'public'))),) | |
STATICFILES_FINDERS = ( |
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
$(which kivy||which python) main.py | |
/usr/bin/which: no kivy in (/home/nedr/apps/pyenv/shims:/home/nedr/apps/pyenv/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/sbin:/usr/sbin:/usr/lib/rabbitmq/bin:/home/nedr/.local/bin:/home/nedr/bin) | |
[INFO ] Kivy v1.8.0 | |
[WARNING ] [Config ] Older configuration version detected (0 instead of 10) | |
[WARNING ] [Config ] Upgrading configuration in progress. | |
[INFO ] [Logger ] Record log in /home/nedr/.kivy/logs/kivy_14-05-14_0.txt | |
[INFO ] [Factory ] 157 symbols loaded | |
[DEBUG ] [Cache ] register <kv.lang> with limit=None, timeout=Nones | |
[DEBUG ] [Cache ] register <kv.image> with limit=None, timeout=60s | |
[DEBUG ] [Cache ] register <kv.atlas> with limit=None, timeout=Nones |
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
LOGGING = { | |
"version": 1, | |
"disable_existing_loggers": True, | |
# "filters": { | |
# "require_debug_false": { | |
# "()": "django.utils.log.RequireDebugFalse" | |
# } | |
# }, | |
"handlers": { | |
"mail_admins": { |
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
glib.timeout_add(100, self.new_title) | |
# glib.timeout_add(100, self.worker) | |
# self.worker() | |
def new_title(self): | |
window = False | |
while not window: | |
window = wnck.screen_get_default().get_active_window() | |
title = window.title() | |
if self.title != title: |
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
#!/bin/python | |
import gtk | |
import wnck | |
import glib | |
import datetime | |
import time | |
class WindowTitle(object): |
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
#!/bin/python | |
# -*- coding: utf-8 -*- | |
import os | |
import time | |
quantity = 500 | |
directory = '/home/nedr/mount/files/' | |
level0 = 200 | |
level1 = 10000 |
NewerOlder