Adding color to postgres slowlogs. Making login a bit less heavy on the db. And fixing feed count munin.

This commit is contained in:
Samuel Clay 2015-07-21 15:53:37 -07:00
parent e65cd64e8a
commit 34d008d600
3 changed files with 10 additions and 3 deletions

View file

@ -28,7 +28,14 @@ class LoginForm(forms.Form):
username = self.cleaned_data.get('username', '').lower()
password = self.cleaned_data.get('password', '')
user = User.objects.filter(Q(username__iexact=username) | Q(email__iexact=username))
if '@' in username:
user = User.objects.filter(email=username)
if not user:
user = User.objects.filter(email__iexact=username)
else:
user = User.objects.filter(username=username)
if not user:
user = User.objects.filter(username__iexact=username)
if user:
user = user[0]
if username and user:

View file

@ -356,7 +356,7 @@ log_min_duration_statement = 5000 # -1 is disabled, 0 logs all statements
#log_duration = off
#log_error_verbosity = default # terse, default, or verbose messages
#log_hostname = off
log_line_prefix = '%t %h' # special values:
log_line_prefix = '\033[32m%t %h \033[0m' # special values:
# %a = application name
# %u = user name
# %d = database name

View file

@ -34,7 +34,7 @@ class NBMuninGraph(MuninGraph):
return {
'feeds': feeds_count,
'subscriptions_count': subscriptions_count,
'subscriptions': subscriptions_count,
'profiles': MSocialProfile.objects.count(),
'social_subscriptions': MSocialSubscription.objects.count(),
}