
    >Tfc                     :   d dl mZ d dlmZ d dlmZmZ d dlmZ d dl	m
Z d dlmZmZ d dlT d dlT d dlmZ d d	lmZmZ d d
lmZ d dlmZ d dlmZ d dlmZ ddlmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z( dZ) G d dee          Z* G d de*          Z+ G d de+          Z, G d de+          Z- G d de+          Z. G d de+          Z/ G d de+          Z0 G d d e+          Z1 G d! d"e+          Z2 G d# d$e+          Z3 G d% d&e*          Z4 G d' d(ee*          Z5d)S )*    )GenericForeignKey)ValidationError)MaxValueValidatorMinValueValidator)models)gettext_lazy)	MPTTModelTreeForeignKey)*)ChangeLoggedModel)
ColorFieldNaturalOrderingField)TreeManager)naturalize_interface)TrackingModelMixin)WirelessRoleChoices   )
ConsolePortConsoleServerPort	DeviceBay	FrontPort	InterfaceInventoryItem	ModuleBayPowerOutlet	PowerPortRearPort)
ConsolePortTemplateConsoleServerPortTemplateDeviceBayTemplateFrontPortTemplateInterfaceTemplateInventoryItemTemplateModuleBayTemplatePowerOutletTemplatePowerPortTemplateRearPortTemplatec                   r    e Zd Z ej        dej        d          Z ej         ed          d ed                    Z	 e
ddd	
          Z ej         ed          dd	 ed                    Z ej         ed          dd	          Z G d d          Zd Zd Z fdZ fdZ fdZ xZS )ComponentTemplateModeldcim.DeviceType
%(class)ssto	on_deleterelated_namename@   zb{module} is accepted as a substitution for the module bay position when attached to a module type.)verbose_name
max_length	help_textd   T)target_fieldr3   blanklabelzPhysical labelr2   r3   r7   r4   description   )r2   r3   r7   c                   <    e Zd ZdZdZ ej        dd          fZdS )ComponentTemplateModel.MetaT)device_type_namer>   r0   /%(app_label)s_%(class)s_unique_device_type_namefieldsr0   N__name__
__module____qualname__abstractorderingr   UniqueConstraintconstraints     K/var/www/html/netbox-4.1.3/netbox/dcim/models/device_component_templates.pyMetar=   B   s<        +#F#.F  
rM   rO   c                 B    | j         r| j         d| j          dS | j        S )Nz ())r8   r0   selfs    rN   __str__zComponentTemplateModel.__str__L   s/    : 	1i004:0000yrM   c                     t                      )zF
        Instantiate a new component on the specified Device.
        )NotImplementedErrorrS   devices     rN   instantiatez"ComponentTemplateModel.instantiateQ   s     "###rM   c                 x     t                      j        |i | | j                            d          | _        d S )Ndevice_type_id)super__init____dict__get_original_device_type)rS   argskwargs	__class__s      rN   r]   zComponentTemplateModel.__init__W   s@    $)&))) &*]%6%67G%H%H"""rM   c                 b    t                                          |          }| j        |_        |S N)r\   to_objectchanger>   related_objectrS   actionobjectchangerc   s      rN   rf   z&ComponentTemplateModel.to_objectchange]   s+    ww..v66&*&6#rM   c                     t                                                       | j        j        s.| j        | j        k    r t          dt          d          i          d S d S )Nr>   z?Component templates cannot be moved to a different device type.)r\   clean_stateaddingr`   r[   r   _rS   rc   s    rN   rl   zComponentTemplateModel.cleanb   sf    {! 	d&@DDW&W&W!q!bcc#   	 	&W&WrM   )rE   rF   rG   r   
ForeignKeyCASCADEr>   	CharFieldro   r0   r   r?   r8   r:   rO   rT   rY   r]   rf   rl   __classcell__rc   s   @rN   r)   r)   $   s       #&#.!  K
 6QvYY!p
 
  D !   E
 FQwZZ!$%%	  E #&"Q}%%  K
 
 
 
 
 
 
 
  
$ $ $I I I I I    
        rM   r)   c                        e Zd ZdZ ej        dej        ddd          Z ej        dej        ddd          Z G d d          Z	 fd	Z
 fd
Zd Zd Zd Z xZS )ModularComponentTemplateModelzV
    A ComponentTemplateModel which supports optional assignment to a ModuleType.
    r*   r+   Tr-   r.   r/   r7   nullzdcim.ModuleTypec                   ^    e Zd ZdZdZ ej        dd           ej        dd          fZdS )	"ModularComponentTemplateModel.MetaT)r>   module_typer?   r@   rA   rB   r|   r0   /%(app_label)s_%(class)s_unique_module_type_nameNrD   rL   rM   rN   rO   r{   ~   s[        :#F#.F   $F#.F  	
rM   rO   c                     t                                          |          }| j        | j        |_        n| j        | j        |_        |S re   )r\   rf   r>   rg   r|   rh   s      rN   rf   z-ModularComponentTemplateModel.to_objectchange   sK    ww..v66'*.*:L'')*.*:L'rM   c                     t                                                       | j        r#| j        rt	          t          d                    | j        s#| j        st	          t          d                    d S d S )NzTA component template cannot be associated with both a device type and a module type.zSA component template must be associated with either a device type or a module type.)r\   rl   r>   r|   r   ro   rp   s    rN   rl   z#ModularComponentTemplateModel.clean   s      	 0 	!hii    	(8 	!ghh  	 	 	 	rM   c                     g }|j         j                                                            d          }|r-|                    |           |j        r|j        j        }nd }|-|                                 |S )Nmodule)rX   
modulebaysallselect_relatedappend
module_bayr   reverse)rS   r   modulesall_module_bayss       rN   _get_module_treez.ModularComponentTemplateModel._get_module_tree   s     -26688GGQQ 	NN6"""  *1  	 	rM   c                     t           | j        vr| j        S |rI|                     |          }| j        }|D ](}|                    t           |j        j        d          })|S | j        S Nr   )MODULE_TOKENr0   r   replacer   position)rS   r   r   r0   s       rN   resolve_namez*ModularComponentTemplateModel.resolve_name   st    ty((9 	++F33G9D! Q Q||L&2C2LaPPKyrM   c                     t           | j        vr| j        S |rI|                     |          }| j        }|D ](}|                    t           |j        j        d          })|S | j        S r   )r   r8   r   r   r   r   )rS   r   r   r8   s       rN   resolve_labelz+ModularComponentTemplateModel.resolve_label   su    tz)): 	++F33GJE! S SlF4E4NPQRRLzrM   )rE   rF   rG   __doc__r   rq   rr   r>   r|   rO   rf   rl   r   r   r   rt   ru   s   @rN   rw   rw   k   s         $&#.!  K $&#.!  K
 
 
 
 
 
 
 
          
 
 

 
 
 
 
 
 
rM   rw   c                       e Zd ZdZ ej         ed          ded          Ze	Z
 G d dej                  Zd Zd	 Zd
S )r   zF
    A template for a ConsolePort to be created for a new Device.
    type2   Tr2   r3   choicesr7   c                   :    e Zd Z ed          Z ed          ZdS )ConsolePortTemplate.Metazconsole port templatezconsole port templatesNrE   rF   rG   ro   r2   verbose_name_pluralrL   rM   rN   rO   r      1        q011a 899rM   rO   c           	           | j         d|                     |                    d                    |                     |                    d                    | j        d|S Nr   )r0   r8   r   rL   component_modelr   r_   r   r   rS   rb   s     rN   rY   zConsolePortTemplate.instantiate   l    #t# 
""6::h#7#788$$VZZ%9%9::
 
 	
 
 	
rM   c                 8    | j         | j        | j        | j        dS Nr0   r   r8   r:   r   rR   s    rN   to_yamlzConsolePortTemplate.to_yaml   &    IIZ+	
 
 	
rM   N)rE   rF   rG   r   r   rs   ro   ConsolePortTypeChoicesr   r   r   rw   rO   rY   r   rL   rM   rN   r   r      s          6QvYY&	  D "O: : : : :,1 : : :
 
 

 
 
 
 
rM   r   c                       e Zd ZdZ ej         ed          ded          Ze	Z
 G d dej                  Zd Zde_        d	 Zd
S )r   zL
    A template for a ConsoleServerPort to be created for a new Device.
    r   r   Tr   c                   :    e Zd Z ed          Z ed          ZdS )ConsoleServerPortTemplate.Metazconsole server port templatezconsole server port templatesNr   rL   rM   rN   rO   r      s1        q788a ?@@rM   rO   c           	           | j         d|                     |                    d                    |                     |                    d                    | j        d|S r   r   r   s     rN   rY   z%ConsoleServerPortTemplate.instantiate   r   rM   c                 8    | j         | j        | j        | j        dS r   r   rR   s    rN   r   z!ConsoleServerPortTemplate.to_yaml  r   rM   N)rE   rF   rG   r   r   rs   ro   r   r   r   r   rw   rO   rY   do_not_call_in_templatesr   rL   rM   rN   r   r      s          6QvYY&	  D (OA A A A A,1 A A A
 
 
 ,0K(
 
 
 
 
rM   r   c            	       d    e Zd ZdZ ej         ed          ded          Z ej	         ed          dd e
d          g ed          	          Z ej	         ed
          dd e
d          g ed          	          ZeZ G d dej                  Zd Zde_         fdZd Z xZS )r&   zD
    A template for a PowerPort to be created for a new Device.
    r   r   Tr   zmaximum drawr   zMaximum power draw (watts))r2   r7   ry   
validatorsr4   zallocated drawzAllocated power draw (watts)c                   :    e Zd Z ed          Z ed          ZdS )PowerPortTemplate.Metazpower port templatezpower port templatesNr   rL   rM   rN   rO   r   '  1        q.//a 677rM   rO   c           	           | j         d|                     |                    d                    |                     |                    d                    | j        | j        | j        d|S )Nr   )r0   r8   r   maximum_drawallocated_drawrL   )r   r   r_   r   r   r   r   r   s     rN   rY   zPowerPortTemplate.instantiate+  sx    #t# 
""6::h#7#788$$VZZ%9%9::*.
 
 
 
 	
rM   c                     t                                                       | j        N| j        I| j        | j        k    r;t	          dt          d                              | j                  i          d S d S d S )Nr   z@Allocated draw cannot exceed the maximum draw ({maximum_draw}W).)r   )r\   rl   r   r   r   ro   formatrp   s    rN   rl   zPowerPortTemplate.clean6  s    (T-@-L"T%666%$a(j&k&k&r&r  AE  AR&r  'S  'S'    )(-L-L66rM   c                 P    | j         | j        | j        | j        | j        | j        dS )Nr0   r   r   r   r8   r:   r   rR   s    rN   r   zPowerPortTemplate.to_yaml?  s2    II -"1Z+
 
 	
rM   )rE   rF   rG   r   r   rs   ro   PowerPortTypeChoicesr   PositiveIntegerFieldr   r   r   r   r   rw   rO   rY   r   rl   r   rt   ru   s   @rN   r&   r&     si         6QvYY$	  D /6.Q~&&%%a(()!011  L 1V0Q'((%%a(()!233  N  O8 8 8 8 8,1 8 8 8
 
 
 ,0K(    
 
 
 
 
 
 
rM   r&   c            	       "    e Zd ZdZ ej         ed          ded          Z ej	        dej
        ddd          Z ej         ed	          ded ed
                    ZeZ G d dej                  Z fdZd Zde_        d Z xZS )r%   zF
    A template for a PowerOutlet to be created for a new Device.
    r   r   Tr   zdcim.PowerPortTemplatepoweroutlet_templates)r-   r.   r7   ry   r/   zfeed legzPhase (for three-phase feeds))r2   r3   r   r7   r4   c                   :    e Zd Z ed          Z ed          ZdS )PowerOutletTemplate.Metazpower outlet templatezpower outlet templatesNr   rL   rM   rN   rO   r   e  r   rM   rO   c                    t                                                       | j        r| j        rJ| j        j        | j        k    r5t	          t          d                              | j                            | j        rL| j        j        | j        k    r9t	          t          d                              | j                            d S d S d S )NzDParent power port ({power_port}) must belong to the same device type)
power_portzDParent power port ({power_port}) must belong to the same module type)r\   rl   r   r>   r   ro   r   r|   rp   s    rN   rl   zPowerOutletTemplate.cleani  s     ? 	 DO$?4CS$S$S%\]]ddptpd  A  A    DO$?4CS$S$S%\]]ddptpd  A  A  	 	
 $S$SrM   c           	      r   | j         rF| j                             |                    d                    }t          j        j        dd|i|}nd } | j        d|                     |                    d                    |                     |                    d                    | j        || j        d|S )Nr   r0   )r0   r8   r   r   feed_legrL   )	r   r   r_   r   objectsr   r   r   r   )rS   rb   power_port_namer   s       rN   rY   zPowerOutletTemplate.instantiatew  s    ? 	"o::6::h;O;OPPO"*.NNONvNNJJJ#t# 
""6::h#7#788$$VZZ%9%9::!]
 
 
 
 	
rM   c                 l    | j         | j        | j        r| j        j         nd | j        | j        | j        dS )Nr0   r   r   r   r8   r:   r   rR   s    rN   r   zPowerOutletTemplate.to_yaml  s?    II26/K$/..tZ+
 
 	
rM   )rE   rF   rG   r   r   rs   ro   PowerOutletTypeChoicesr   rq   SET_NULLr   PowerOutletFeedLegChoicesr   r   r   rw   rO   rl   rY   r   r   rt   ru   s   @rN   r%   r%   J  s7         6QvYY&	  D #"#/,  J  vQz]])!344  H "O: : : : :,1 : : :    
 
 
 ,0K(
 
 
 
 
 
 
rM   r%   c            
           e Zd ZdZ ededd          Z ej         e	d          de
          Z ej         e	d	          d
          Z ej        d e	d                    Z ej        dej        ddd e	d                    Z ej        ded e	d                    Z ej        ded e	d                    Z ej        ded e	d                    ZeZ G d dej                  Z fdZd Zde_        d Z xZ S )r"   zC
    A template for a physical data interface on a new Device.
    r0   r5   T)r6   naturalize_functionr3   r7   r   r   r2   r3   r   enabled)r2   defaultFzmanagement only)r   r2   rS   bridge_interfaceszbridge interface)r-   r.   r/   ry   r7   r2   zPoE mode)r3   r   r7   r2   zPoE type   zwireless rolec                   :    e Zd Z ed          Z ed          ZdS )InterfaceTemplate.Metazinterface templatezinterface templatesNr   rL   rM   rN   rO   r     1        q-..a 566rM   rO   c                 \   t                                                       | j        r| j        r.| j        | j        k    rt          dt          d          i          | j        rL| j        | j        j        k    r7t          dt          d                              | j                  i          | j	        rL| j	        | j        j	        k    r7t          dt          d                              | j                  i          | j
        r| j        t          vrt          ddi          d S d S )Nbridgez)An interface cannot be bridged to itself.z?Bridge interface ({bridge}) must belong to the same device type)r   z?Bridge interface ({bridge}) must belong to the same module typerf_rolez5Wireless role may be set only on wireless interfaces.)r\   rl   r   pk	bridge_idr   ro   r>   r   r|   r   r   WIRELESS_IFACE_TYPESrp   s    rN   rl   zInterfaceTemplate.clean  sI   ; 
	w b4>TW44%x3^1_1_&`aaa D$48O$O$O%a abbiiquq|i}}'     D$48O$O$O%a abbiiquq|i}}'    < 	DI-AAA!R#   	 	AArM   c                     | j         d|                     |                    d                    |                     |                    d                    | j        | j        | j        | j        | j        | j	        d|S )Nr   )r0   r8   r   r   	mgmt_onlypoe_modepoe_typer   rL   )
r   r   r_   r   r   r   r   r   r   r   r   s     rN   rY   zInterfaceTemplate.instantiate  s    #t# 

""6::h#7#788$$VZZ%9%9::Ln]]L

 

 

 

 
	
rM   c                     | j         | j        | j        | j        | j        | j        | j        r| j        j         nd | j        | j        | j	        d
S )N
r0   r   r   r   r8   r:   r   r   r   r   r   rR   s    rN   r   zInterfaceTemplate.to_yaml  sS    II|Z+*.+?dk&&4|
 
 	
rM   )!rE   rF   rG   r   r   r   r?   r   rs   ro   InterfaceTypeChoicesr   BooleanFieldr   r   rq   r   r   InterfacePoEModeChoicesr   InterfacePoETypeChoicesr   r   r   r   r   rw   rO   rl   rY   r   r   rt   ru   s   @rN   r"   r"     s         ! 0	  E 6QvYY$  D
 "f!Qy\\  G $#Q())  I V/(Q)**  F  v'Qz]]	  H  v'Qz]]	  H f#Q''	  G  O7 7 7 7 7,1 7 7 7    (
 
 
 ,0K(
 
 
 
 
 
 
rM   r"   c                   Z    e Zd ZdZ ej         ed          de          Z e	 ed          d          Z
 ej        dej        d	
          Z ej         ed          d ee           ee          g          ZeZ G d dej                  Z fdZd Zde_        d Z xZS )r!   zH
    Template for a pass-through port on the front of a new Device.
    r   r   r   colorTr2   r7   zdcim.RearPortTemplatefrontport_templatesr,   zrear port positionr   r2   r   r   c                       e Zd Z ej        dd           ej        dd           ej        dd          fZ ed          Z ed	          Zd
S )FrontPortTemplate.Metar@   rA   rB   r}   r~   )	rear_portrear_port_positionz1%(app_label)s_%(class)s_unique_rear_port_positionzfront port templatezfront port templatesN)	rE   rF   rG   r   rJ   rK   ro   r2   r   rL   rM   rN   rO   r     s        #F#.F   $F#.F   $F#:H  
 q.//a 677rM   rO   c                    t                                                       	 | j        j        | j        k    r5t	          t          d                              | j                            | j        | j        j        k    rKt	          t          d                              | j        | j        j	        | j        j                            d S # t          j        $ r Y d S w xY w)Nz6Rear port ({name}) must belong to the same device type)r0   zTInvalid rear port position ({position}); rear port {name} has only {count} positions)r   r0   count)r\   rl   r   r>   r   ro   r   r   	positionsr0   r'   DoesNotExistrp   s    rN   rl   zFrontPortTemplate.clean+  s    	 ~)T-===%NOOVV\`\jVkk  
 &)AAA%lmmtt!%!8!^0"n6 u     BA  , 	 	 	DD	s   B*C C"!C"c           
      ~   | j         rF| j                             |                    d                    }t          j        j        dd|i|}nd } | j        d|                     |                    d                    |                     |                    d                    | j        | j        || j	        d|S )Nr   r0   )r0   r8   r   r   r   r   rL   )
r   r   r_   r   r   r   r   r   r   r   )rS   rb   rear_port_namer   s       rN   rY   zFrontPortTemplate.instantiateC  s    > 	!^88H9M9MNNN (,KK.KFKKIII#t# 
""6::h#7#788$$VZZ%9%9::*#6
 
 
 
 	
rM   c                 f    | j         | j        | j        | j        j         | j        | j        | j        dS )Nr0   r   r   r   r   r8   r:   r   rR   s    rN   r   zFrontPortTemplate.to_yamlT  s9    IIZ,"&"9Z+
 
 	
rM   )rE   rF   rG   r   r   rs   ro   PortTypeChoicesr   r   r   rq   rr   r   PositiveSmallIntegerFieldr   REARPORT_POSITIONS_MINr   REARPORT_POSITIONS_MAXr   r   r   rw   rO   rl   rY   r   r   rt   ru   s   @rN   r!   r!     sg         6QvYY  D
 JQwZZ  E "!".*  I
 :9Q+,,455455
    O8 8 8 8 8,1 8 8 8$    0
 
 
 ,0K(	
 	
 	
 	
 	
 	
 	
rM   r!   c                      e Zd ZdZ ej         ed          de          Z e	 ed          d          Z
 ej         ed          d	 ee           ee          g
          ZeZ G d dej                  Zd Zde_        d ZdS )r'   zG
    Template for a pass-through port on the rear of a new Device.
    r   r   r   r   Tr   r   r   r   c                   :    e Zd Z ed          Z ed          ZdS )RearPortTemplate.Metazrear port templatezrear port templatesNr   rL   rM   rN   rO   r   x  r   rM   rO   c           	           | j         d|                     |                    d                    |                     |                    d                    | j        | j        | j        d|S )Nr   )r0   r8   r   r   r   rL   )r   r   r_   r   r   r   r   r   s     rN   rY   zRearPortTemplate.instantiate|  sv    #t# 
""6::h#7#788$$VZZ%9%9::*n
 
 
 
 	
rM   c                 P    | j         | j        | j        | j        | j        | j        dS )Nr0   r   r   r   r8   r:   r  rR   s    rN   r   zRearPortTemplate.to_yaml  s0    IIZZ+
 
 	
rM   N)rE   rF   rG   r   r   rs   ro   r   r   r   r   r   r   r   r   r   r   r   r   rw   rO   rY   r   r   rL   rM   rN   r'   r'   `  s         6QvYY  D
 JQwZZ  E 10Q{^^455455
  I O7 7 7 7 7,1 7 7 7
 
 
 ,0K(
 
 
 
 
rM   r'   c                       e Zd ZdZ ej         ed          dd ed                    ZeZ	 G d de
j                  Zd	 Zde_        d
 ZdS )r$   zK
    A template for a ModuleBay to be created for a new parent Device.
    r   r   Tz:Identifier to reference when renaming installed componentsr9   c                   :    e Zd Z ed          Z ed          ZdS )ModuleBayTemplate.Metazmodule bay templatezmodule bay templatesNr   rL   rM   rN   rO   r    r   rM   rO   c                 B     | j         d| j        | j        | j        d|S )N)r0   r8   r   rL   )r   r0   r8   r   r   s     rN   rY   zModuleBayTemplate.instantiate  s<    #t# 
*]
 
 	
 
 	
rM   c                 8    | j         | j        | j        | j        dS )Nr0   r8   r   r:   r  rR   s    rN   r   zModuleBayTemplate.to_yaml  s&    IZ+	
 
 	
rM   N)rE   rF   rG   r   r   rs   ro   r   r   r   rw   rO   rY   r   r   rL   rM   rN   r$   r$     s           vQz]]!PQQ	  H  O8 8 8 8 8,1 8 8 8
 
 
 ,0K(
 
 
 
 
rM   r$   c                   \    e Zd ZdZeZ G d dej                  Zd Zde_	        d Z
d ZdS )	r    zK
    A template for a DeviceBay to be created for a new parent Device.
    c                   :    e Zd Z ed          Z ed          ZdS )DeviceBayTemplate.Metazdevice bay templatezdevice bay templatesNr   rL   rM   rN   rO   r    r   rM   rO   c                 F    |                      || j        | j                  S )N)rX   r0   r8   )r   r0   r8   rW   s     rN   rY   zDeviceBayTemplate.instantiate  s,    ##* $ 
 
 	
rM   Tc                     | j         rO| j         j        t          j        k    r7t	          t          d                              | j                             d S d S )Nz[Subdevice role of device type ({device_type}) must be set to "parent" to allow device bays.)r>   )r>   subdevice_roleSubdeviceRoleChoicesROLE_PARENTr   ro   r   rR   s    rN   rl   zDeviceBayTemplate.clean  sr     	 0 ?CWCc c c!qrryy  GK  GWy  X  X  	 	 c crM   c                 ,    | j         | j        | j        dS )Nr0   r8   r:   r  rR   s    rN   r   zDeviceBayTemplate.to_yaml  s!    IZ+
 
 	
rM   N)rE   rF   rG   r   r   r   r)   rO   rY   r   rl   r   rL   rM   rN   r    r      s           O8 8 8 8 8%* 8 8 8
 
 
 ,0K(  
 
 
 
 
rM   r    c                      e Zd ZdZ edej        dddd          Z ej        de	ej
        ddd          Z ej        dd	          Z ed
d          Z ej        dej
        ddd          Z ej        dej
        ddd          Z ej        d ed          d ed                    Z e            ZeZ G d d          Zd Zde_        dS )r#   zP
    A template for an InventoryItem to be created for a new parent Device.
    rS   child_itemsT)r-   r.   r/   r7   ry   db_indexzcontenttypes.ContentType+)r-   limit_choices_tor.   r/   r7   ry   )r7   ry   component_typecomponent_id)ct_fieldfk_fieldzdcim.InventoryItemRoleinventory_item_templatesrx   zdcim.Manufacturerr   zpart IDz%Manufacturer-assigned part identifier)r3   r2   r7   r4   c                       e Zd ZdZ ej        d          fZ ej        dd          fZ e	d          Z
 e	d          Zd	S )
InventoryItemTemplate.Meta)device_type__id
parent__idr?   )r  r  )rC   )r>   parentr0   z6%(app_label)s_%(class)s_unique_device_type_parent_namerB   zinventory item templatezinventory item templatesN)rE   rF   rG   rI   r   IndexindexesrJ   rK   ro   r2   r   rL   rM   rN   rO   r  	  sx        =FL BCCC
 $F#8M  
 q233a :;;rM   rO   c                    | j         r"t          j        j        dd| j         j        i|nd }| j        r+| j        j        } |j        j        dd| j        j        i|}nd } | j        d|| j        | j        || j        | j	        | j
        d|S )Nr0   )r!  r0   r8   	componentrolemanufacturerpart_idrL   )r!  r   r   r_   r0   r%  r   r8   r&  r'  r(  )rS   rb   r!  modelr%  s        rN   rY   z!InventoryItemTemplate.instantiate  s    OS{d&*KK0@KFKKK`d> 	N2E))MMt~/BMfMMIII#t# 	
**L	
 	
 	
 	
 		
rM   N)rE   rF   rG   r   r
   r   rr   r!  rq   !MODULAR_COMPONENT_TEMPLATE_MODELSPROTECTr  PositiveBigIntegerFieldr  r   r%  r&  r'  rs   ro   r(  r   r   r   r   rO   rY   r   rL   rM   rN   r#   r#     s         ^."  F 'V&%:.  N 261  L "!!  I 6#./  D %6$./  L fQy\\!;<<	  G kmmG#O< < < < < < < <
 
 
" ,0K(((rM   r#   N)6"django.contrib.contenttypes.fieldsr   django.core.exceptionsr   django.core.validatorsr   r   	django.dbr   django.utils.translationr   ro   mptt.modelsr	   r
   dcim.choicesdcim.constantsnetbox.modelsr   utilities.fieldsr   r   utilities.mpttr   utilities.orderingr   utilities.trackingr   wireless.choicesr   device_componentsr   r   r   r   r   r   r   r   r   r   __all__r)   rw   r   r   r&   r%   r"   r!   r'   r$   r    r#   rL   rM   rN   <module>r=     s   @ @ @ @ @ @ 2 2 2 2 2 2 G G G G G G G G       6 6 6 6 6 6 1 1 1 1 1 1 1 1         + + + + + + = = = = = = = = & & & & & & 3 3 3 3 3 3 1 1 1 1 1 1 0 0 0 0 0 0                       D D D D D.0B D D DNY Y Y Y Y$: Y Y Yx
 
 
 
 
7 
 
 
D 
  
  
  
  
 =  
  
  
F;
 ;
 ;
 ;
 ;
5 ;
 ;
 ;
|E
 E
 E
 E
 E
7 E
 E
 E
Pg
 g
 g
 g
 g
5 g
 g
 g
Ta
 a
 a
 a
 a
5 a
 a
 a
H/
 /
 /
 /
 /
4 /
 /
 /
d 
  
  
  
  
5  
  
  
F
 
 
 
 
. 
 
 
@S0 S0 S0 S0 S0I'= S0 S0 S0 S0 S0rM   