Admin Page Customization Questions

32 views
Skip to first unread message

G Z

unread,
Jul 15, 2014, 11:59:45 AM7/15/14
to django...@googlegroups.com

I have a few questions, is it possible to template the admin page?

second I'm trying to customize some of the individuals pages for my particular issue
I have a table named vm_licenses and a licenses table, I have my models set up like the following:



class Vm_license(models.Model):
   vm_license_id = models.BigIntegerField(primary_key = True, editable = False, db_column = 'vm_license_id')
   #license= models.ForeignKey(License,  on_delete = models.PROTECT)
   license = models.ManyToManyField(License)
   vm = models.ForeignKey(Vm,  on_delete = models.PROTECT)
  
   class Meta:
      managed = False
      db_table = 'vm_licenses'

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


here is my admin page

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




I want to be able to associate licenses with vms like the picture above just select which ones are active and move them over. How do i do this.

The way it is now i get the following

Exception Type: DatabaseError
Exception Value:
ORA-00942: table or view does not exist
Exception Location: /usr/local/lib/python2.7/dist-packages/django/db/backends/oracle/base.py in execute, line 816

but the table does exist because if i change it from manytomany back to foreignkey it will work again.
Message has been deleted

Michiel Overtoom

unread,
Jul 15, 2014, 3:54:45 PM7/15/14
to django...@googlegroups.com

On Jul 15, 2014, at 17:59, G Z wrote:

>
> I have a few questions, is it possible to template the admin page?

Yes, you can copy the default admin templates and change them. It is described here:

https://docs.djangoproject.com/en/dev/intro/tutorial02/#customize-the-admin-look-and-feel

Greetings,

--
"Good programming is not learned from generalities, but by seeing how significant programs can be made clean, easy to read, easy to maintain and modify, human-engineered, efficient, and reliable, by the application of common sense and good programming practices. Careful study and imitation of good programs leads to better writing."
- Kernighan and Plauger, motto of 'Software Tools'




Reply all
Reply to author
Forward
0 new messages