better filter for lowercase email addresses
This commit is contained in:
@@ -55,47 +55,44 @@ class Command(BaseCommand):
|
|||||||
name = m.subject
|
name = m.subject
|
||||||
cntr += 1
|
cntr += 1
|
||||||
# get a list of users
|
# get a list of users
|
||||||
theusers = User.objects.filter(email=from_address)
|
# theusers = User.objects.filter(email=from_address)
|
||||||
for u in theusers:
|
ther = [
|
||||||
try:
|
r for r in Rower.objects.all() if r.user.email.lower() == from_address
|
||||||
rr = Rower.objects.get(user=u.id)
|
]
|
||||||
if extension == 'zip':
|
for rr in ther:
|
||||||
z = zipfile.ZipFile(a.document)
|
if extension == 'zip':
|
||||||
for f in z.namelist():
|
z = zipfile.ZipFile(a.document)
|
||||||
f2 = z.extract(f,path='media/')
|
for f in z.namelist():
|
||||||
try:
|
f2 = z.extract(f,path='media/')
|
||||||
wid = [
|
try:
|
||||||
make_new_workout_from_email(rr,f2[6:],name)
|
wid = [
|
||||||
]
|
make_new_workout_from_email(rr,f2[6:],name)
|
||||||
res += wid
|
|
||||||
link = 'http://rowsandall.com/rowers/workout/'+str(wid)+'/edit'
|
|
||||||
dd = send_confirm(u,name,link)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
# move attachment and make workout
|
|
||||||
try:
|
|
||||||
wid = [
|
|
||||||
make_new_workout_from_email(rr,
|
|
||||||
a.document,
|
|
||||||
name)
|
|
||||||
]
|
]
|
||||||
res += wid
|
res += wid
|
||||||
link = 'http://rowsandall.com/rowers/workout/'+str(wid[0])+'/edit'
|
link = 'http://rowsandall.com/rowers/workout/'+str(wid)+'/edit'
|
||||||
|
|
||||||
except:
|
|
||||||
# replace with code to process error
|
|
||||||
res += ['fail: '+name]
|
|
||||||
donotdelete = 1
|
|
||||||
try:
|
|
||||||
dd = send_confirm(u,name,link)
|
dd = send_confirm(u,name,link)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
else:
|
||||||
|
# move attachment and make workout
|
||||||
|
try:
|
||||||
|
wid = [
|
||||||
|
make_new_workout_from_email(rr,
|
||||||
|
a.document,
|
||||||
|
name)
|
||||||
|
]
|
||||||
|
res += wid
|
||||||
|
link = 'http://rowsandall.com/rowers/workout/'+str(wid[0])+'/edit'
|
||||||
|
|
||||||
|
except:
|
||||||
|
# replace with code to process error
|
||||||
|
res += ['fail: '+name]
|
||||||
|
donotdelete = 1
|
||||||
|
try:
|
||||||
|
dd = send_confirm(u,name,link)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
except Rower.DoesNotExist:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# remove attachment
|
# remove attachment
|
||||||
if donotdelete == 0:
|
if donotdelete == 0:
|
||||||
a.delete()
|
a.delete()
|
||||||
|
|||||||
@@ -211,6 +211,9 @@ class Rower(models.Model):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.user.username
|
return self.user.username
|
||||||
|
|
||||||
|
def clean_email(self):
|
||||||
|
return self.user.email.lower()
|
||||||
|
|
||||||
# Saving a chart as a favorite chart
|
# Saving a chart as a favorite chart
|
||||||
class FavoriteChart(models.Model):
|
class FavoriteChart(models.Model):
|
||||||
y1params = (
|
y1params = (
|
||||||
|
|||||||
Reference in New Issue
Block a user