Merge branch 'current_branch' into 'dev'

migrate update

See merge request !8
feature/fix_generate_pass
Andrey 8 years ago
commit b4211af2ad
  1. 31
      csv/load_comments.py

@ -55,24 +55,31 @@ if __name__ == '__main__':
files = [File.objects.get(id=file) for file in row['files'].split("[")[1].split("]")[0].split(',')
if not file == '']
comment = Comment.objects.create(
comment_exist = Comment.objects.filter(
text=row['text'] or row['bb_text'],
user_key=get_user_model().objects.get(email=row['owner__email']).out_key,
)
date=row['start_date']
).exists()
if row['status'] == 'Одобренно':
p.status = ProgressLesson.STATUSES.done
p.date = row['date']
if not comment_exist:
comment = Comment.objects.create(
text=row['text'] or row['bb_text'],
user_key=get_user_model().objects.get(email=row['owner__email']).out_key,
)
if row['status'] == 'Одобренно':
p.status = ProgressLesson.STATUSES.done
p.finish_date = row['finish_date']
elif row['status'] == 'Отклонено':
p.status = ProgressLesson.STATUSES.fail
elif row['status'] == 'Отклонено':
p.status = ProgressLesson.STATUSES.fail
p.comment_tokens.append(comment.token)
p.save()
p.comment_tokens.append(comment.token)
p.save()
[comment.files.add(file) for file in files]
comment.date = row['date']
comment.save()
[comment.files.add(file) for file in files]
comment.date = row['date']
comment.save()
for i in ProgressLesson.objects.filter(comment_tokens__isnull=False):
if len(i.comment_tokens) % 2 == 1:

Loading…
Cancel
Save