cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
system_image_group.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 # @COPYRIGHT_begin
3 #
4 # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # @COPYRIGHT_end
19 
20 ##
21 # @package src.cm.models.system_image_group
22 #
23 
24 from django.db import models
25 from cm.models.system_image import SystemImage
26 
27 
28 ##
29 #
30 # @model{IMAGE_GROUP}
31 # If a system image have access=group, it has to define the group(s) to which it belongs
32 # The group_id is the same as the users group. Informations on users group are in the CLM.
33 #
34 class SystemImageGroup(models.Model):
35  group_id = models.IntegerField()
36  image = models.ForeignKey(SystemImage)
37 
38  class Meta:
39  app_label = 'cm'
40  unique_together = ("group_id", "image")
41 
42  #method for printing object instance
43  def __unicode__(self):
44  return 'group: ' + str(self.group_id) + ' - sys img: ' + str(self.image.id)
45