o
    eΉh                     @   s8   d dl Z d dlmZ d dlmZmZ G dd deZdS )    N)BaseCommand)StateCountryc                   @   s   e Zd ZdZdd ZdS )Commandz.Import states from CSV and assign country_id=1c                 O   s   t jjdd}tdddd}t|}|D ]}|d }tjj||d qW d    n1 s/w   Y  | j	| j
d	 d S )
N   )pkz&/var/www/apihucms/State-2025-07-30.csv zutf-8)newlineencoding
state_name)namecountryzStates imported successfully.)r   objectsgetopencsv
DictReaderr   get_or_createstdoutwritestyleSUCCESS)selfargsoptionsr   csvfilereaderrowr    r   =/var/www/apihucms/career/management/commands/import_states.pyhandle   s   
zCommand.handleN)__name__
__module____qualname__helpr    r   r   r   r   r      s    r   )r   django.core.management.baser   career.modelsr   r   r   r   r   r   r   <module>   s    