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
description = models.TextField(validators=[MaxLengthValidator(128)], max_length=128, verbose_name='Краткая аннотация', help_text='Максимум 128 символов') | |
description = models.TextField( | |
validators=[MaxLengthValidator(128)], | |
max_length=128, | |
verbose_name='Краткая аннотация', | |
help_text='Максимум 128 символов') |
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
def another_profile(request, id): | |
user2 = CustomUser.objects.get(id = id) | |
if request.user.is_authenticated(): | |
if request.user == user2: | |
viewable = False | |
else: | |
viewable = True | |
userlist = request.user.friends.all() | |
try: | |
Friendship.objects.get(user=request.user) |
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
from dist import * | |
try: | |
from local import * | |
except ImportError: | |
from local_sample import * | |
from warnings import warn | |
warn( | |
'Local settings not found (settings/local.py).' | |
'Using local_sample.py instead.') |
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
filename = os.path.join(root, name) | |
try: | |
os.remove(filename) | |
except OSError: | |
log.error('Error removing file %s' % filename) |
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
a = ['123', '1234', None, '12'] | |
## 1 | |
from operator import methodcaller | |
b = [methodcaller('__len__')(x) for x in a if x] | |
print(b) | |
## 2 | |
b = [len(x) for x in a if x] | |
print(b) |
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
# Use uswsusp | |
SLEEP_MODULE="uswsusp" | |
# Always use suspend_hybrid instead of suspend | |
if [ "$METHOD" = "suspend" ]; then | |
METHOD=suspend_hybrid | |
fi |
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
lst = [] | |
def foo1(bar=lst): | |
bar.append(1) | |
print(bar) | |
foo1() | |
foo1() | |
foo1() |
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 CharacterName(EmbeddedDocument): | |
first = StringField() | |
last = StringField() | |
class Character(Document): | |
name = EmbeddedDocumentField(CharacterName) | |
rating = IntField() |
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
fs.inotify.max_user_watches=100000 |
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
conky.config = { | |
alignment = 'tl', | |
background = true, | |
border_width = 1, | |
default_bar_width = 256, default_bar_height = 4, | |
default_color = 'white', | |
default_outline_color = 'white', | |
default_shade_color = 'black', | |
double_buffer = true, | |
draw_borders = false, |
OlderNewer