@@ -277,41 +277,46 @@ def get_export_users_emails(self, users):
277277 headers = [
278278 "Имя и фамилия" ,
279279 "Возраст" ,
280- "ВУЗ " ,
280+ "Город " ,
281281 "Специальность" ,
282282 "Эл. почта" ,
283283 ]
284284 )
285285
286286 today = date .today ()
287287
288- # date_limit_18 = date(today.year - 18, today.month, today.day)
289- user_ed = UserEducation .objects .select_related (
290- "user" , "user__v2_speciality"
291- ).filter (education_status = "Студент" )
292- # users = (
293- # CustomUser.objects.all()
294- # .select_related("v2_speciality")
295- # )
288+ date_limit_18 = date (today .year - 18 , today .month , today .day )
289+ date_limit_22 = date (today .year - 22 , today .month , today .day )
290+ # user_ed = UserEducation.objects.select_related(
291+ # "user", "user__v2_speciality"
292+ # ).filter(education_status="Студент")
293+ users = (
294+ CustomUser .objects .all ()
295+ .select_related ("v2_speciality" )
296+ .filter (
297+ birthday__gte = date_limit_18 ,
298+ birthday__lte = date_limit_22
299+ )
300+ )
296301 # little_mans = users.filter(birthday__lte=date_limit_18)
297302 # big_mans = users.exclude(id__in=little_mans.values_list("id", flat=True))
298303
299304 # whole_quality = users.count()
300305 # quantity_little_mans = little_mans.count()
301306 # quantity_big_mans = whole_quality - quantity_little_mans
302307
303- for ed in user_ed :
308+ for user in users :
304309 response_data .append (
305310 [
306- ed . user .first_name + " " + ed . user .last_name ,
307- (today .year - ed . user .birthday .year )
308- if ed . user .birthday .year
311+ user .first_name + " " + user .last_name ,
312+ (today .year - user .birthday .year )
313+ if user .birthday .year
309314 else None ,
310- ed . organization_name ,
311- ed . user .v2_speciality
312- if ed . user .v2_speciality
313- else ed . user .speciality ,
314- ed . user .email ,
315+ user . city ,
316+ user .v2_speciality
317+ if user .v2_speciality
318+ else user .speciality ,
319+ user .email ,
315320 ]
316321 )
317322
0 commit comments