Yangi model qoshing xuddi Score model kabi
| Field | Type | Izoh |
|---|---|---|
student_id |
FK → Student | Sertifikat kimga berilgan |
title |
String | Sertifikat nomi |
content |
Text/String | Sertifikat mazmuni yoki description |
issued_at |
DateTime | Berilgan vaqt (default = now) |
certificate_code |
String unique | Unikal sertifikat kodi |
is_verified |
Boolean | Tekshirilgan/yo‘q |
# Student modeli ichida
certificates = relationship('Certificate', back_populates='student')- Student 1 uchun yangi certificate qo‘sh:
title="Python Basics",content="Completed course",certificate_coderandom orqali yarating - Student 2 uchun 2 ta certificate qo‘sh
- Barcha certificate larni oling
is_verified=Falsebo‘lgan certificate lar- Berilgan
student_iduchun barcha certificate lar - certificate_code bo‘yicha certificate qidirish
- issued_at bo‘yicha 5 ta oxirgi certificate
- certificate_code bo‘yicha is_verified=True qil
- Studentlar bo‘yicha certificate soni
- Eng ko‘p certificate olgan student
- is_verified bo‘lgan certificate larni count qilish