o
    d@^hb                     @   sH   d dl Z d dlmZ d dlmZmZmZ d dlmZ G dd deZ	dS )    N)BaseCommand)CollegeProgramsSectionProgram)Coursec                   @   s   e Zd ZdZdd ZdS )CommandzCUpdates the Programs section for Roorkee College of Allied Sciencesc                 O   s  | j | jd ztjjdd}| j | jd|j d|j d W n tj	y;   | j | j
d Y d S w tjj|dd	id
\}}|rU| j | jd n
| j | jd dddddddddddddddddddddddddddd ddd!d"d ddd#d$d ddg}|j   | j | jd% d&}|D ]T}z8tjj|d' d(}	tjj||d) d*|d'  d+|d, |d- d.}
|d7 }| j | jd/|
j d0|
j  W q tj	y   | j | jd1|d'  d2 Y qw | j | jd3 | j | jd4| d5 | j | jd6 |j }|jjdd7 }|jjd d7 }|jjdd7 }| j | jd8| d9| d:| d;|  d S )<Nz3Starting to update Allied Sciences Programs section   )idzFound college: z (ID: )z,Allied Sciences college with ID 5 not found.titlezOur Programs)collegedefaultszCreated Programs sectionzFound existing Programs sectionbpharmzB.PharmUG   )slugnametypeorderz	bpharm-lez
B.Pharm LE   zbsc-nursingzB.Sc. Nursing   zbsc-microbiologyzB.Sc. Microbiology   dpharmzD.PharmDPzmpharm-pharmaceuticszM.Pharm PharmaceuticsPGzmsc-pharmaceutical-chemistryzM.Sc. Pharmaceutical Chemistryzmsc-microbiologyzM.Sc. MicrobiologyzCleared existing programsr   r   )r   r   z/academics/programs/courses//r   r   )programs_sectionr   linkprogram_typer   zCreated program: z -> zCourse with slug 'z' not found, skippingz!Programs section update complete!zCreated z	 programszDAll program URLs use the format: /academics/programs/courses/{slug}/)r   zFinal count - Total: z, UG: z, PG: z, Diploma: )stdoutwritestyleSUCCESSr   objectsgetr   r	   DoesNotExistERRORr   get_or_createprogramsalldeleter   r   creater   WARNINGcountfilter)selfargsoptionsallied_colleger   createdcourse_programscreated_countprogram_datacourseprogramtotal_programsug_programspg_programsdp_programs r=   H/var/www/apihucms/colleges/management/commands/update_allied_programs.pyhandle	   sf   *
($
0zCommand.handleN)__name__
__module____qualname__helpr?   r=   r=   r=   r>   r      s    r   )
osdjango.core.management.baser   colleges.modelsr   r   r   courses.modelsr   r   r=   r=   r=   r>   <module>   s
    