M1Sc@skddlmZddlmZmZddlmZddlmZmZmZddlm Z ddl m Z ddl m ZddlmZddlmZdd lZd efd YZd eefd YZdefdYZdejfdYZdejfdYZddlmZdejfdYZdejfdYZd S(i(tmodels(tdatetimet timedelta(tAbstractBaseUsertBaseUserManagertPermissionsMixin(t send_mail(ttimezone(t ugettext_lazy(t validators(tsettingsNtFuncionarioManagercBseZddZdZRS(c Kstj}|s!tdntj|} |jd|d|d|d|d|dtdtd td |d || } | j|| j d |j | S( sG Creates and saves an EmailUser with the given email and password. sThe given email must be settusernamet matriculatemailthorario_inicial_entradathorario_final_saidatis_stafft is_activet is_superusert last_logint date_joinedtusing( Rtnowt ValueErrorR tnormalize_emailtmodeltFalsetTruet set_passwordtsavet_db( tselfR R RRRtpasswordt extra_fieldsRt funcionariotuser((s./ponto/models.pyt create_users K c Ks\|j|||||||}t|_t|_t|_t|_|jd|j|S(sF Creates and saves a superuser with the given email and password. R(R%Rtis_adminRRRRR( R R R RRRR!R"R$((s./ponto/models.pytcreate_superuser#s!    N(t__name__t __module__tNoneR%R'(((s./ponto/models.pyR s tAbstractFuncionarioc BseZdZejeddddededdejded d gZ ejed ddd eZ ejed ddd eZ ejddddddd e de deZ ejddddddd e de Zejddddddd e de ZejeddddedeZejedde dedZejeddededZejeddejZdZd gZd!d'd"YZd#Zd$Zd(d%Z d&Z!RS()sl Abstract User with the same behaviour as Django's default User but without a username field. Uses email as the USERNAME_FIELD for authentication. Use this if you need to extend EmailUser. Inherits from both the AbstractBaseUser and PermissionMixin. The following attributes are inherited from the superclasses: * password * last_login * is_superuser R t max_lengthituniquet help_textsERequired. 30 characters or fewer. Letters, digits and @/./+/-/_ only.R s ^[\w.@+-]+$sEnter a valid username.tinvalids first nametblanks last namet verbose_names MatrículaisMatrícula do funcionário.tnullsHorário Inicial de EntradasVEste é o horário inicial que começam a contar as horas trabalhadas do funcionário.sHorário Final de SaídasSEste é o horário final encerra a contagenm das horas trabalhadas do funcionário.s email addressitdb_indexs staff statustdefaults9Designates whether the user can log into this admin site.tactiveseDesignates whether this user should be treated as active. Unselect this instead of deleting accounts.s date joinedR tMetacBseZeZdZdZRS(s Funcionários Funcionários(R(R)RtabstractR1tverbose_name_plural(((s./ponto/models.pyR6RscCs d|j|jf}|jS(sI Returns the first_name plus the last_name, with a space in between. s%s %s(t first_namet last_nametstrip(R t full_name((s./ponto/models.pyt get_full_nameWscCs|jS(s$Returns the short name for the user.(R9(R ((s./ponto/models.pytget_short_name^scKs t||||jg|dS(s" Sends an email to this User. N(RR(R tsubjecttmessaget from_emailtkwargs((s./ponto/models.pyt email_usercscCsd|j|jfS(Ns%s %s(R9R:(R ((s./ponto/models.pyt __unicode__js(N("R(R)t__doc__Rt CharFieldt_RR tRegexValidatorR R9R:RR t TimeFieldRRt EmailFieldRt BooleanFieldRRt DateTimeFieldRRRtUSERNAME_FIELDtREQUIRED_FIELDSR6R=R>R*RCRD(((s./ponto/models.pyR+0s(K!!0**'    t FuncionariocBs0eZdZeZdejfdYZRS(sZ Concrete class of AbstractEmailUser. Use this if you don't need to extend EmailUser. R6cBseZdZRS(tAUTH_USER_MODEL(R(R)t swappable(((s./ponto/models.pyR6ws(R(R)RER tobjectsRR6(((s./ponto/models.pyROns t BatidaPontoc Bs~eZejedddddedeZejdddddededeZ d Z d d d YZ d Z RS(R1s FuncionárioR.s3Funcionário a quem esta batida de ponto se refere.R0R2sMomento da Batida de Pontos)Data e hora de quando o ponto foi batido.R-cCs t|jS(N(tunicodetmomento_batidaponto(R ((s./ponto/models.pyRDsR6cBseZdZdZdZRS(sBatida de PontosBatidas de PontoR#RU(s funcionariosmomento_batidaponto(R(R)R1R8tunique_together(((s./ponto/models.pyR6sc Cs&d}d |jj}|jjdkr;d|jj}nd}d}d}|jjdkrrd|jj}nt|jj}|jjdkrd|jj}nt|jj}|jjdkrd|jj}nt|jj}d|||jjd|jj|||f}|S(NtJaneirot FevereirosMarçotAbriltMaiotJunhotJulhotAgostotSetembrotOutubrotNovembrotDezembros%di s0%dts%s de %s de %d, às %s:%s:%si( RWRXsMarçoRYRZR[R\R]R^R_R`Ra(RUtdaythourtstrtminutetsecondtmonthtyear(R tmesest dia_formatadothoras_formatadastminutos_formatadostsegundos_formatadostsemana((s./ponto/models.pytmomento_batidaponto_formatados$0(( R(R)Rt ForeignKeyRORR#RLRRURDR6Rp(((s./ponto/models.pyRS{s '* t Sincronizacaoc BsHeZejdddddedeZdZdd dYZRS( R1s"Momento da Última SincronizaçãoR.s>Data e hora de quando a última sincronização foi realizada.R0R2cCs t|jS(N(RTt data_hora(R ((s./ponto/models.pyRDsR6cBseZdZdZRS(sSincronizaçãosSincronizações(R(R)R1R8(((s./ponto/models.pyR6s((R(R)RRLRRsRDR6(((s./ponto/models.pyRrs$ (t mark_safet Comentarioc BsDeZejedddddedeZejdddddedeZej ddddd d dedeZ ej dd dd d d de de d dZ ejdddddeZejdddddeZejdddddedeZdZdddYZdZdZdZRS(R1s FuncionárioR.s3Funcionário a quem esta batida de ponto se refere.R0R2tDatasData do comentário.sTexto do ComentárioR,t500s Arquivo anexos)Arquivo anexo para avaliação da chefia.t upload_totarquivos_anexossAvaliado pela chefia.R4sAprovado pela chefia.sTempo gasto ou relacionados*Tempo gasto ou relacionado ao comentário.cCs t|jS(N(RTtdata(R ((s./ponto/models.pyRDsR6cBseZdZdZRS(s Comentários Comentários(R(R)R1R8(((s./ponto/models.pyR6scCsD|jr<t|jjdd}td|j|fSdSdS(Nt/is %s sNenhum arquivo em anexo.(t arquivo_anexoRetsplitRt(R t nome_arquivo((s./ponto/models.pytlink_arquivo_anexos cCs|jjdS(Ns%d/%m/%Y(Rztstrftime(R ((s./ponto/models.pyt data_textoscCs"|jr dS|jrdSdSdS(NtAprovadot RejeitadosAguardando avaliação(taprovadotavaliado_pela_chefia(R ((s./ponto/models.pytsituacaos   ((R(R)RRqRORR#t DateFieldRzt TextFieldttextot FileFieldRR|RKRRRIt tempo_gastoRDR6RRR(((s./ponto/models.pyRus'$*0$   t Observacaoc BsreZejdddddedeZejdddddd dedeZd Zd d d YZ RS(R1RvR.sData da observação.R0R2sTexto da Observaçãos=Digite a observação desta data para todos os funcionários.R,RwcCs t|jS(N(RTRz(R ((s./ponto/models.pyRDsR6cBseZdZdZRS(s Observaçãos Observações(R(R)R1R8(((s./ponto/models.pyR6s(( R(R)RRRRzRRRDR6(((s./ponto/models.pyRs$* (t django.dbRRRtdjango.contrib.auth.modelsRRRtdjango.core.mailRt django.utilsRtdjango.utils.translationRRGt django.coreR t django.confR tosR R+ROtModelRSRrtdjango.utils.safestringRtRuR(((s./ponto/models.pyts" > / .