Admin.py

class vm_license_admin(admin.ModelAdmin):
    list_display = ('vm',)
    search_fields = ('vm__vm_name',)
    ordering = ('vm',)
    filter_horizontal = ('license',)
    
admin.site.register(Vm_license, vm_license_admin)



class License(models.Model):
   license_id = models.BigIntegerField(primary_key = True, editable = 
False, db_column = 'license_id')
   license_authority = models.ForeignKey(License_authoritie,  on_delete = 
models.PROTECT)
   product = models.CharField(max_length = 20)
   
   
   class Meta:
      managed = False
      db_table = 'licenses'
      ordering = ['product']

   def __unicode__(self):  # Python 3: def __str__(self):
      return self.product
         
class Vm_license(models.Model):
   vm_license_id = models.BigIntegerField(primary_key = True, editable = 
False, db_column = 'vm_license_id')
   license= models.ManyToManyField(License, through="vm_assignments")
   vm= models.ForeignKey(Vm,  on_delete = models.PROTECT)

   
   class Meta:
      managed = False
      db_table = 'vm_licenses'
      
class vm_assignments(models.Model):
   vm = models.ForeignKey(Vm,  on_delete = models.PROTECT)
   vm_license = models.ForeignKey(Vm_license,  on_delete = models.PROTECT)
   license = models.ForeignKey(License,  on_delete = models.PROTECT)


but the only thing that shows on vm_licenses is the vm there is no 
manytomany form element like im trying to get im simply mis understanding 
this

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3fc0ed4f-09f7-4e08-af13-0eda5ea6b045%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to