These are chat archives for allegro/ralph

1st
Apr 2015
flashput
@flashput
Apr 01 2015 01:42
@vi4m I turn mysql generallog on , and get a sql like this: SELECT cmdb_ci.id, cmdb_ci.created, cmdb_ci.modified, cmdb_ci.cache_version, cmdb_ci.uid, cmdb_ci.name, `cmdb
ci.business_service,cmdb_ci.technical_service,cmdb_ci.pci_scope,cmdb_ci.barcode,cmdb_ci.content_type_id,cmdb_ci.object_id,cmdb_ci.stat
e,cmdb_ci.status,cmdb_ci.type_id,cmdb_ci.zabbix_id,cmdb_ci.added_manuallyFROMcmdb_ciINNER JOINcmdb_citypeON (cmdb_ci.type_id=cmdb
_citype.id) WHERE (cmdb_ci.state= 1 ANDcmdb_citype.name` = 'Environment' )
flashput
@flashput
Apr 01 2015 01:48
ralph_assets/forms.py
queryset=models_device.DeviceEnvironment.objects.all(),
……
class DeviceEnvironment(models_ci.CI):
objects = DeviceEnvironmentManager()
class DeviceEnvironmentManager(db.Manager):
def get_query_set(self):
return super(DeviceEnvironmentManager, self).get_query_set().filter(
type__name=models_ci.CI_TYPES.ENVIRONMENT,
state=models_ci.CI_STATE_TYPES.ACTIVE,
)
return super(…..)….filter(…..type__name=models_ci.CI_TYPES.ENVIRONMENT,…)
if I translate Environment to other word, then the param value passed to filter() will change to the word I translated
damian1976
@damian1976
Apr 01 2015 05:42
P
Mateusz Kurek
@mkurek
Apr 01 2015 05:50
@flashput no it's not - CITYPES is Choices instance, which behave under the hood pretty much like regular list - when you call CI_TYPES.ENVIRONMENT you are only interested in id (index) which ENVIRONMENT has on that list. ('Environment') is only "pretty name" (to display in UI) for that and it not affect the way how Choice works
flashput
@flashput
Apr 01 2015 06:32
@mkurek but ENVIRONMENT = _(‘Environment’) causes sql query changed .
if I translate Environment to another word in django.po
flashput
@flashput
Apr 01 2015 06:49
mysql> select name from cmdb_citype;
+-------------------+
| name |
+-------------------+
| Application |
| BusinessLine |
| Data Center |
| Device |
| Environment |
| Network |
| NetworkTerminator |
| Procedure |
| ProfitCenter |
| Service |
| Venture |
| VentureRole |
+-------------------+
12 rows in set (0.00 sec)
✪ vi4m Marcin Kliks
@vi4m
Apr 01 2015 08:12
don't be afraid to modify it, just tell us where will it break, and we will fix it
flashput
@flashput
Apr 01 2015 08:17
how to tell you, mail or talk here?
✪ vi4m Marcin Kliks
@vi4m
Apr 01 2015 08:18
talk here, and if agreed on it , make an issue on github