Skip to content

Instantly share code, notes, and snippets.

@norrs
Created June 20, 2012 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save norrs/2958684 to your computer and use it in GitHub Desktop.
Save norrs/2958684 to your computer and use it in GitHub Desktop.
from nav.models.rrd import RrdDataSource
datasources = RrdDataSource.objects.filter(rrd_file__key='interface').select_related('rrd_file')
datasource_loookup = {}
for data in datasources:
interface = int(data.rrd_file.value)
if interface in datasource_loookup:
datasource_loookup[interface].append(data)
else:
datasource_loookup.update( {interface: [data] } )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment