def save(self, *args, **kwargs):
adding_new = False<EOL>if not self.pk or (not self.cpu and not self.ram):<EOL><INDENT>if self.model.cpu:<EOL><INDENT>self.cpu = self.model.cpu<EOL><DEDENT>if self.model.ram:<EOL><INDENT>self.ram = self.model.ram<EOL><DEDENT>adding_new = True<EOL><DEDENT>super(DeviceToModelRel, self).save(*args, **kwargs)<EOL>try:<EOL><INDENT>antenna_model = self.model.antennamodel<EOL><DEDENT>except AntennaModel.DoesNotExist:<EOL><INDENT>antenna_model = False<EOL><DEDENT>if adding_new and antenna_model:<EOL><INDENT>antenna = Antenna(<EOL>device=self.device,<EOL>model=self.model.antennamodel<EOL>)<EOL>wireless_interfaces = self.device.interface_set.filter(type=<NUM_LIT:2>)<EOL>if len(wireless_interfaces) > <NUM_LIT:0>:<EOL><INDENT>antenna.radio = wireless_interfaces[<NUM_LIT:0>]<EOL><DEDENT>antenna.save()<EOL><DEDENT>
when creating a new record fill CPU and RAM info if available