Skip to content
Snippets Groups Projects
Select Git revision
  • afe2813b057cf114ed93eda93a1c944641cfb9cc
  • python3 default protected
  • feature/exabgp_support2.bgpextcommunity
  • feature/exabgp_support2.django4.2
  • feature/exabgp_support2
  • fix/existingcheck_honor_fragtype
  • feature/python3-authz_netmask
  • feature/authz_netmask
  • fix/wrong_ratelimit_stats
  • feature/requirements_version_update2024-01
  • feature/split_celery
  • feature/improved-warning-mails
  • fix/reenable_expireset_via_restapi
  • feature/admin_user_delete_with_owned_rule_reassigning1
  • feature/admin_user_delete_with_owned_rule_reassigning
  • feature/branded_doc
  • fix/forked_snmp_polling_worker_exit_issue
  • fix/false_user_activation_error
  • feature/exabgp_with_docker-compose
  • fix/prefix_overlap_handling
  • fix/js_security_issues-a
  • save1
  • rpm-1.5-7
  • working1
  • myv1.6
  • t12b1
  • v1.5_newnew2
  • merged_final
  • v1.5_newnew
  • startstop_old
  • myadd2
  • tomas3
  • merge_jra2t6_and_RESTAPI
  • mytomas2
  • mynew1
  • new_jra2t6
  • v1.5_final
  • fod16_ruleroutes-merged_old
  • merged_new
  • v1.6_new_old
  • v1.5_new_old_follower
41 results

models.py

Blame
  • models.py 1.51 KiB
    # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
    # vim: tabstop=4:shiftwidth=4:softtabstop=4:expandtab
    
    # Copyright © 2011-2014 Greek Research and Technology Network (GRNET S.A.)
    # Copyright © 2011-2014 Leonidas Poulopoulos (@leopoul)
    # 
    # Permission to use, copy, modify, and/or distribute this software for any
    # purpose with or without fee is hereby granted, provided that the above
    # copyright notice and this permission notice appear in all copies.
    # 
    # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
    # TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
    # FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
    # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
    # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
    # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
    # SOFTWARE.
    
    from django.db import models
    from django.contrib.auth.models import User
    from peers.models import *
    
    
    class UserProfile(models.Model):
        user = models.OneToOneField(User)
        peer = models.ForeignKey(Peer)
        
        class Meta:
            permissions = (
                    ("overview", "Can see registered users and rules"),
                )
    
        
        def __unicode__(self):
            return "%s:%s" %(self.user.username, self.peer.peer_name)
    
        def get_address_space(self):
            networks = self.domain.networks.all()
            if not networks:
                return False
            return networks