mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Some bug fixes
This commit is contained in:
parent
1f31d3b56f
commit
a4c5d48159
@ -97,7 +97,7 @@ class Product(models.Model):
|
|||||||
"""
|
"""
|
||||||
Method to see if that object can be edited by the given user
|
Method to see if that object can be edited by the given user
|
||||||
"""
|
"""
|
||||||
if user.is_in_group(settings.SITH_GROUPS['accounting-admin']['name']):
|
if user.is_in_group(settings.SITH_GROUPS['accounting-admin']['name']) or user.is_in_group(settings.SITH_GROUPS['counter-admin']['name']):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class GetUserForm(forms.Form):
|
|||||||
cleaned_data = super(GetUserForm, self).clean()
|
cleaned_data = super(GetUserForm, self).clean()
|
||||||
cus = None
|
cus = None
|
||||||
if cleaned_data['code'] != "":
|
if cleaned_data['code'] != "":
|
||||||
cus = Customer.objects.filter(account_id=cleaned_data['code']).first()
|
cus = Customer.objects.filter(account_id__iexact=cleaned_data['code']).first()
|
||||||
elif cleaned_data['id'] is not None:
|
elif cleaned_data['id'] is not None:
|
||||||
cus = Customer.objects.filter(user=cleaned_data['id']).first()
|
cus = Customer.objects.filter(user=cleaned_data['id']).first()
|
||||||
sub = get_subscriber(cus.user) if cus is not None else None
|
sub = get_subscriber(cus.user) if cus is not None else None
|
||||||
|
@ -38,8 +38,8 @@ class Subscriber(User):
|
|||||||
db.commit()
|
db.commit()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
with open(settings.BASE_DIR+"/user_fail.log", "a") as f:
|
with open(settings.BASE_DIR+"/user_fail.log", "a") as f:
|
||||||
print("FAIL to add user %s (%s %s - %s) to old site" % (self.id, self.first_name, self.last_name,
|
print("FAIL to add user %s (%s %s - %s) to old site" % (self.id, self.first_name.encode('utf-8'),
|
||||||
self.email), file=f)
|
self.last_name.encode('utf-8'), self.email), file=f)
|
||||||
print("Reason: %s" % (repr(e)), file=f)
|
print("Reason: %s" % (repr(e)), file=f)
|
||||||
db.rollback()
|
db.rollback()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user