Skip to content

Instantly share code, notes, and snippets.

View shadow-identity's full-sized avatar
🖤

Pavel Nedrigailov shadow-identity

🖤
View GitHub Profile
>>> 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
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)
{
"data": {
"checkboxes": [
{
"preferences": {
"cheetos": {
"describe": {
"Count": 20.0,
"First Quartile (Q1)": 0.0,
"Max": 1.0,
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)
# 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 = (
$(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
LOGGING = {
"version": 1,
"disable_existing_loggers": True,
# "filters": {
# "require_debug_false": {
# "()": "django.utils.log.RequireDebugFalse"
# }
# },
"handlers": {
"mail_admins": {
@shadow-identity
shadow-identity / time_tracker.py
Created December 12, 2013 07:10
does not work
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:
#!/bin/python
import gtk
import wnck
import glib
import datetime
import time
class WindowTitle(object):
#!/bin/python
# -*- coding: utf-8 -*-
import os
import time
quantity = 500
directory = '/home/nedr/mount/files/'
level0 = 200
level1 = 10000