~eltonplima/sqm/devel

« back to all changes in this revision

Viewing changes to core/network/models.py

  • Committer: Elton Pereira de Lima
  • Date: 2009-11-12 10:59:01 UTC
  • Revision ID: elton@elton-laptop-20091112105901-ra7hfonxr08r7ps6
All foreign key of network models now null=False and blank=False
Improved speed to importer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
class Host(models.Model):
56
56
    ip = models.CharField(max_length=255, blank=True, null=True)
57
57
    name = models.CharField(max_length=255, null=True)
58
 
    domain = models.ForeignKey(Domain)
 
58
    domain = models.ForeignKey(Domain, blank=False, null=False)
59
59
 
60
60
    def __unicode__(self):
61
61
        return self.ip
65
65
    """ 
66
66
    protocol://host/path/resource
67
67
    """
68
 
    protocol = models.ForeignKey(Protocol)
69
 
    host = models.ForeignKey(Host)
 
68
    protocol = models.ForeignKey(Protocol, blank=False, null=False)
 
69
    host = models.ForeignKey(Host, blank=False, null=False)
70
70
    path = models.CharField(max_length=2500)
71
71
 
72
72
    def __unicode__(self):
151
151
    hash_line = models.CharField(max_length=32, unique=True)
152
152
    timestamp = models.CharField(max_length=14) # timestamp
153
153
    process_time = models.IntegerField()
154
 
    port = models.ForeignKey(Port)
155
 
    host_network = models.ForeignKey(Host, related_name="traffic_host_network")
156
 
    request_status = models.ForeignKey(Request_status)
157
 
    http_status_code = models.ForeignKey(HTTP_status_code)
 
154
    port = models.ForeignKey(Port, blank=False, null=False)
 
155
    host_network = models.ForeignKey(Host, related_name="traffic_host_network", blank=False, null=False)
 
156
    request_status = models.ForeignKey(Request_status, blank=False, null=False)
 
157
    http_status_code = models.ForeignKey(HTTP_status_code, blank=False, null=False)
158
158
    bytes = models.IntegerField()
159
 
    request_method = models.ForeignKey(Request_method)
160
 
    url = models.ForeignKey(URL) # The ip address inside of the URL.
161
 
    user = models.ForeignKey(User)
162
 
    hierarchy_status = models.ForeignKey(Hierarchy_status)
163
 
    mime_type = models.ForeignKey(Mime_type)
 
159
    request_method = models.ForeignKey(Request_method, blank=False, null=False)
 
160
    url = models.ForeignKey(URL, blank=False, null=False)
 
161
    user = models.ForeignKey(User, blank=False, null=False)
 
162
    hierarchy_status = models.ForeignKey(Hierarchy_status, blank=False, null=False)
 
163
    mime_type = models.ForeignKey(Mime_type, blank=False, null=False)
164
164
 
165
165
    def __unicode__(self):
166
166
        return self.host_network