Thursday, November 29, 2018

Re: Human Readable Values



On Tuesday, November 27, 2018 at 8:15:12 AM UTC-5, Nelson Varela wrote:
show your code that renders the values

This is the class

class Hardware(models.Model):
    hardware_id = models.AutoField(primary_key=True)
    compute_asset_name = models.TextField(blank=False, null=False)
    hardware_type = models.ForeignKey('HardwareAssetType',on_delete=models.CASCADE)
    project_id = models.ForeignKey('Project',on_delete=models.CASCADE)
    ipaddress = models.IPAddressField
    macaddress = models.CharField(max_length=16)
    version_number = models.CharField(max_length=128)
    enginering_build = models.BooleanField
    service_tag = models.CharField(max_length=128)
    serial_number = models.CharField(max_length=128)
    cpu_type = models.CharField(max_length=128)
    cores = models.IntegerField
    ramGB = models.IntegerField
   
    def __str__(self):
        return self.compute_asset_name

This is the template
{% extends 'labmanager/BasePage.html' %}
{% load labmanager_filters %}
{% block title %}Lab Assets{% endblock %}

{% block content %}
{% if user.is_authenticated %}
<title>Hardware Page</title>
<form action="{% url 'labmanager:HardwarePage' %}" method='post'>
<table align='center' border="1" cellspacing="0" cellpadding="0" bordercolor="#00338e" >
        <tr bgcolor="#00338e" >
            <td><b><font color="#ffffff">Hardware Item</font></b></td>
            <td><b><font color="#ffffff">Asset</font><b></td>
        </tr>

        <tr align="center">

            <td >
            Compute Asset Name
            </td>
            <td><p> {{ hardware.compute_asset_name }} </p> </td>
        </tr>        

        <tr align="center">

            <td >
            Hardware Type
            </td>
            <td><p> {{ hardware.hardware_type }} </p> </td>
        </tr>   

        <tr align="center">

            <td >
            IP Address
            </td>
            <td><p> {{ hardware.ipaddress }} </p> </td>
        </tr>   
        <tr align="center">

            <td >
            MAC Address
            </td>
            <td><p> {{ hardware.macaddress }} </p> </td>
        </tr>        

        <tr align="center">

            <td >
            Version Number
            </td>
            <td><p> {{ hardware.version_number}} </p> </td>
        </tr>   

        <tr align="center">

            <td >
            Release Type
            </td>
            <td><p> {{ hardware|build_type }} </p> </td>
        </tr>  

        <tr align="center">

            <td >
            Service Tab
            </td>
            <td><p> {{ hardware.service_tab }} </p> </td>
        </tr>   
        <tr align="center">

            <td >
            Serial Number
            </td>
            <td><p> {{ hardware.serial_number }} </p> </td>
        </tr>        

        <tr align="center">

            <td >
            CPU Type
            </td>
            <td><p> {{ hardware.cpu_type}} </p> </td>
        </tr>   

        <tr align="center">

            <td >
            cores
            </td>
            <td><p> {{hardware.cores}} </p> </td>
        </tr>
       
        <tr align="center">
            <td >
            RAM(GB)
            </td>
            <td><p> {{ hardware.ramGB}} </p> </td>
        </tr>     
</form>
</table>

{% endif %}
{% endblock %}

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b8183578-a7c0-4b0a-a174-6ea7a5a470b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment