Просмотр исходного кода

Merge pull request #939 from digitalocean/develop

Release v1.9.0-r1
Jeremy Stretch 9 лет назад
Родитель
Сommit
ce26b566a4

+ 28 - 0
.github/ISSUE_TEMPLATE.md

@@ -0,0 +1,28 @@
+<!--
+    Please note: GitHub issues are to be used only for feature requests
+    and bug reports. For installation assistance or general discussion,
+    please join us on the mailing list:
+
+        https://groups.google.com/forum/#!forum/netbox-discuss
+
+    Please indicate "bug report" or "feature request" below. Be sure to
+    search the existing set of issues (both open and closed) to see if
+    a similar issue has already been raised.
+-->
+### Issue type:
+
+<!--
+    If filing a bug, please indicate the version of Python and NetBox
+    you are running. (This is not necessary for feature requests.)
+-->
+**Python version:**
+**NetBox version:**
+
+<!--
+    If filing a bug, please record the exact steps taken to reproduce
+    the bug and any errors messages that are generated.
+
+    If filing a feature request, please precisely describe the data
+    model or workflow you would like to see implemented, and provide a
+    use case.
+-->

+ 14 - 0
.github/PULL_REQUEST_TEMPLATE.md

@@ -0,0 +1,14 @@
+<!--
+    Thank you for your interest in contributing to NetBox! Please note
+    that our contribution policy requires that a feature request or bug
+    report be opened for approval prior to filing a pull request. This
+    helps avoid wasting time and effort on something that we might not
+    be able to accept.
+
+    Please indicate the relevant feature request or bug report below.
+-->
+### Fixes:
+
+<!--
+    Please include a summary of the proposed changes below.
+-->

+ 76 - 47
CONTRIBUTING.md

@@ -1,84 +1,113 @@
 ## Getting Help
 ## Getting Help
 
 
-If you encounter any issues installing or using NetBox, try one of the following resources to get assistance. Please
-**do not** open an issue on GitHub except to report bugs or request features.
+If you encounter any issues installing or using NetBox, try one of the
+following resources to get assistance. Please **do not** open a GitHub
+issue except to report bugs or request features.
 
 
-### Freenode IRC
+### Mailing List
 
 
-Join the #netbox channel on [Freenode IRC](https://freenode.net/). You can connect to Freenode at irc.freenode.net using
-an IRC client, or you can use their [webchat client](https://webchat.freenode.net/).
+We have established a Google Groups Mailing List for issues and general
+discussion. This is the best forum for obtaining assistance with NetBox
+installation. You can find us [here](https://groups.google.com/forum/#!forum/netbox-discuss).
 
 
-### Mailing List
+### Freenode IRC
 
 
-We have established a Google Groups Mailing List for issues and general discussion. You can find us [here]( https://groups.google.com/forum/#!forum/netbox-discuss).
+For real-time discussion, you can join the #netbox channel on [Freenode](https://freenode.net/).
+You can connect to Freenode at irc.freenode.net using an IRC client, or
+you can use their [webchat client](https://webchat.freenode.net/).
 
 
 ## Reporting Bugs
 ## Reporting Bugs
 
 
 * First, ensure that you've installed the [latest stable version](https://github.com/digitalocean/netbox/releases) of
 * First, ensure that you've installed the [latest stable version](https://github.com/digitalocean/netbox/releases) of
-NetBox. If you're running an older version, it's possible that the bug has already been fixed.
+NetBox. If you're running an older version, it's possible that the bug
+has already been fixed.
 
 
 * Next, check the GitHub [issues list](https://github.com/digitalocean/netbox/issues) to see if the bug you've found has
 * Next, check the GitHub [issues list](https://github.com/digitalocean/netbox/issues) to see if the bug you've found has
-already been reported. If you think you may be experiencing a reported issue that hasn't already been resolved, please
-click "add a reaction" in the top right corner of the issue and add a thumbs up (+1). You might also want to add a
-comment describing how it's affecting your installation. This will allow us to prioritize bugs based on how many users
-are affected.
-
-* If you haven't found an existing issue that describes your suspected bug, please inquire about it on IRC or Google Groups.
-**Do not** file an issue until you have received confirmation that it is in fact a bug. Invalid issues are very
-distracting and slow the pace at which NetBox is developed.
-
-* When submitting an issue, please be as descriptive as possible. Be sure to include:
+already been reported. If you think you may be experiencing a reported
+issue that hasn't already been resolved, please click "add a reaction"
+in the top right corner of the issue and add a thumbs up (+1). You might
+also want to add a comment describing how it's affecting your
+installation. This will allow us to prioritize bugs based on how many
+users are affected.
+
+* If you haven't found an existing issue that describes your suspected
+bug, please inquire about it on the mailing list. **Do not** file an
+issue until you have received confirmation that it is in fact a bug.
+Invalid issues are very distracting and slow the pace at which NetBox is
+developed.
+
+* When submitting an issue, please be as descriptive as possible. Be
+sure to include:
 
 
     * The environment in which NetBox is running
     * The environment in which NetBox is running
-    * The exact steps that can be taken to reproduce the issue (if applicable)
-    * Any error messages returned
+    * The exact steps that can be taken to reproduce the issue (if
+      applicable)
+    * Any error messages generated
     * Screenshots (if applicable)
     * Screenshots (if applicable)
 
 
-* Keep in mind that we prioritize bugs based on their severity and how much work is required to resolve them. It may
-take some time for someone to address your issue.
+* Keep in mind that we prioritize bugs based on their severity and how
+much work is required to resolve them. It may take some time for someone
+to address your issue.
 
 
 ## Feature Requests
 ## Feature Requests
 
 
 * First, check the GitHub [issues list](https://github.com/digitalocean/netbox/issues) to see if the feature you're
 * First, check the GitHub [issues list](https://github.com/digitalocean/netbox/issues) to see if the feature you're
-requesting is already listed. (Be sure to search closed issues as well, since some feature requests are rejected.) If
-the feature you'd like to see has already been requested, click "add a reaction" in the top right corner of the issue
-and add a thumbs up. This ensures that the issue has a better chance of making it onto the roadmap. Also feel free
-to add a comment with any additional justification for the feature. (However, note that comments with no substance
-other than a "+1" will be deleted as spam. Please use GitHub's reactions feature to indicate your support.)
-
-* While suggestions for new features are welcome, it's important to limit the scope of NetBox's feature set to avoid
-feature creep. For example, the following features would be firmly out of scope for NetBox:
+requesting is already listed. (Be sure to search closed issues as well,
+since some feature requests are rejected.) If the feature you'd like to
+see has already been requested, click "add a reaction" in the top right
+corner of the issue and add a thumbs up (+1). This ensures that the
+issue has a better chance of making it onto the roadmap. Also feel free
+to add a comment with any additional justification for the feature.
+(However, note that comments with no substance other than a "+1" will be
+deleted. Please use GitHub's reactions feature to indicate your
+support.)
+
+* While suggestions for new features are welcome, it's important to
+limit the scope of NetBox's feature set to avoid feature creep. For
+example, the following features would be firmly out of scope for NetBox:
 
 
     * Ticket management
     * Ticket management
     * Network state monitoring
     * Network state monitoring
     * Acting as a DNS server
     * Acting as a DNS server
     * Acting as an authentication server
     * Acting as an authentication server
 
 
-* Before filing a new feature request, propose it on IRC or Reddit first. Feedback you receive there will help validate
-and shape the proposed feature before filing a formal issue.
+* Before filing a new feature request, consider raising your idea on the
+mailing list first. Feedback you receive there will help validate and
+shape the proposed feature before filing a formal issue.
 
 
-* Good feature requests are very narrowly defined. Be sure to enumerate specific functionality and data schema. The more
-effort you put into writing a feature request, the better its chances are of being implemented. Overly broad feature
-requests will be closed.
+* Good feature requests are very narrowly defined. Be sure to enumerate
+specific functionality and data schema. The more effort you put into
+writing a feature request, the better its chance is of being
+implemented. Overly broad feature requests will be closed.
 
 
-* When submitting a feature request on GitHub, be sure to include the following:
+* When submitting a feature request on GitHub, be sure to include the
+following:
 
 
     * A detailed description of the proposed functionality
     * A detailed description of the proposed functionality
-    * A use case for the feature; who would use it and what value it would add to NetBox
-    * A rough description of any changes necessary to the database schema
-    * Any third-party libraries or other resources which would be involved
+    * A use case for the feature; who would use it and what value it
+      would add to NetBox
+    * A rough description of changes necessary to the database schema
+      (if applicable)
+    * Any third-party libraries or other resources which would be
+      involved
 
 
 ## Submitting Pull Requests
 ## Submitting Pull Requests
 
 
-* Be sure to open an issue before starting work on a pull request, and discuss your idea with the NetBox maintainers
-before beginning work​. This will help prevent wasting time on something that might we might not be able to implement.
-When suggesting a new feature, also make sure it won't conflict with any work that's already in progress.
+* Be sure to open an issue before starting work on a pull request, and
+discuss your idea with the NetBox maintainers before beginning work​.
+This will help prevent wasting time on something that might we might not
+be able to implement. When suggesting a new feature, also make sure it
+won't conflict with any work that's already in progress.
 
 
-* When submitting a pull request, please be sure to work off of the `develop` branch, rather than `master`. In NetBox,
-the `develop` branch is used for ongoing development, while `master` is used for tagging new stable releases.
+* When submitting a pull request, please be sure to work off of the
+`develop` branch, rather than `master`. In NetBox, the `develop` branch
+is used for ongoing development, while `master` is used for tagging new
+stable releases.
 
 
-* All code submissions should meet the following criteria (CI will enforce these checks):
+* All code submissions should meet the following criteria (CI will
+enforce these checks):
 
 
     * Python syntax is valid
     * Python syntax is valid
-    * All tests pass when run with `./manage.py test netbox/`
-    * PEP 8 compliance is enforced, with the exception that lines may be greater than 80 characters in length
+    * All tests pass when run with `./manage.py test`
+    * PEP 8 compliance is enforced, with the exception that lines may be
+      greater than 80 characters in length

+ 4 - 16
netbox/dcim/forms.py

@@ -82,7 +82,7 @@ class RegionForm(BootstrapMixin, forms.ModelForm):
 #
 #
 
 
 class SiteForm(BootstrapMixin, CustomFieldForm):
 class SiteForm(BootstrapMixin, CustomFieldForm):
-    region = TreeNodeChoiceField(queryset=Region.objects.all())
+    region = TreeNodeChoiceField(queryset=Region.objects.all(), required=False)
     slug = SlugField()
     slug = SlugField()
     comments = CommentField()
     comments = CommentField()
 
 
@@ -1468,19 +1468,13 @@ class InterfaceConnectionForm(BootstrapMixin, forms.ModelForm):
         ]
         ]
 
 
         # Initialize rack_b choices if site_b is set
         # Initialize rack_b choices if site_b is set
-        if self.is_bound and self.data.get('site_b'):
-            self.fields['rack_b'].queryset = Rack.objects.filter(site__pk=self.data['site_b'])
-        elif self.initial.get('site_b'):
+        if self.initial.get('site_b'):
             self.fields['rack_b'].queryset = Rack.objects.filter(site=self.initial['site_b'])
             self.fields['rack_b'].queryset = Rack.objects.filter(site=self.initial['site_b'])
         else:
         else:
             self.fields['rack_b'].choices = []
             self.fields['rack_b'].choices = []
 
 
         # Initialize device_b choices if rack_b or site_b is set
         # Initialize device_b choices if rack_b or site_b is set
-        if self.is_bound and self.data.get('rack_b'):
-            self.fields['device_b'].queryset = Device.objects.filter(rack__pk=self.data['rack_b'])
-        elif self.is_bound and self.data.get('site_b'):
-            self.fields['device_b'].queryset = Device.objects.filter(site__pk=self.data['site_b'], rack__isnull=True)
-        elif self.initial.get('rack_b'):
+        if self.initial.get('rack_b'):
             self.fields['device_b'].queryset = Device.objects.filter(rack=self.initial['rack_b'])
             self.fields['device_b'].queryset = Device.objects.filter(rack=self.initial['rack_b'])
         elif self.initial.get('site_b'):
         elif self.initial.get('site_b'):
             self.fields['device_b'].queryset = Device.objects.filter(site=self.initial['site_b'], rack__isnull=True)
             self.fields['device_b'].queryset = Device.objects.filter(site=self.initial['site_b'], rack__isnull=True)
@@ -1488,13 +1482,7 @@ class InterfaceConnectionForm(BootstrapMixin, forms.ModelForm):
             self.fields['device_b'].choices = []
             self.fields['device_b'].choices = []
 
 
         # Initialize interface_b choices if device_b is set
         # Initialize interface_b choices if device_b is set
-        if self.is_bound:
-            device_b_interfaces = Interface.objects.filter(device=self.data['device_b']).exclude(
-                form_factor__in=VIRTUAL_IFACE_TYPES
-            ).select_related(
-                'circuit_termination', 'connected_as_a', 'connected_as_b'
-            )
-        elif self.initial.get('device_b'):
+        if self.initial.get('device_b'):
             device_b_interfaces = Interface.objects.filter(device=self.initial['device_b']).exclude(
             device_b_interfaces = Interface.objects.filter(device=self.initial['device_b']).exclude(
                 form_factor__in=VIRTUAL_IFACE_TYPES
                 form_factor__in=VIRTUAL_IFACE_TYPES
             ).select_related(
             ).select_related(

+ 1 - 1
netbox/netbox/settings.py

@@ -12,7 +12,7 @@ except ImportError:
                                "the documentation.")
                                "the documentation.")
 
 
 
 
-VERSION = '1.9.0'
+VERSION = '1.9.0-r1'
 
 
 # Import local configuration
 # Import local configuration
 for setting in ['ALLOWED_HOSTS', 'DATABASE', 'SECRET_KEY']:
 for setting in ['ALLOWED_HOSTS', 'DATABASE', 'SECRET_KEY']:

+ 1 - 1
netbox/templates/circuits/provider.html

@@ -152,7 +152,7 @@
                         </td>
                         </td>
                         <td>
                         <td>
                             {% if c.tenant %}
                             {% if c.tenant %}
-                                <a href="{% url 'tenants:tenant' slug=c.tenant.slug %}">{{ c.tenant }}</a>
+                                <a href="{% url 'tenancy:tenant' slug=c.tenant.slug %}">{{ c.tenant }}</a>
                             {% else %}
                             {% else %}
                                 <span class="text-muted">&mdash;</span>
                                 <span class="text-muted">&mdash;</span>
                             {% endif %}
                             {% endif %}