1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

492 Commits

Author SHA1 Message Date
Jeremy Stretch
8364e56e86 Fixes #2676: Fix exception when passing dictionary value to a ChoiceField 2018-12-11 17:00:20 -05:00
Jeremy Stretch
65edffea63 Merge v2.5 work 2018-12-07 10:51:28 -05:00
Jeremy Stretch
2a07e8f3f0 Move queryset_to_csv() utility into ObjectListView to allow overriding by individual views 2018-12-05 16:35:59 -05:00
Jeremy Stretch
686a65880e Closes #2495: Enable deep-merging of config context data 2018-12-05 14:34:49 -05:00
Jeremy Stretch
08b4b24296 Fixes #2622: Enable filtering cables by multiple types/colors 2018-11-28 14:22:55 -05:00
Tatsushi Demachi
c3cdf8e97e Fix type mismatches in API view (#2429)
* Fix tags field to be shown as array in API view

`tags` field in serializers is defineded as `TagListSerializerField`.
It should be shown as an array value in API view but actually, it is a
simple string value.

This fixes it by introducing a new `FieldInspector` to handle
`TagListSerializerField` type field as an array. It doesn't affects any
other type fields.

* Fix SerializedPKRelatedField type API expression

A field definded as `SerializedPKRelatedField` should be shown as an
array of child serializer objects in a response value definition in API
view but it is shown as an array of primary key values (usually
`integer` type) of a child serializer.

This fixes it by introducing a new `FieldInspector` to handle the field.
It doesn't affect any other type fields.

* Fix request parameter representation in API view

In API view, representation of a parameter defined as a sub class of
`WritableNestedSerializer` should be vary between a request and a
response. For example, `tenant` field in `IPAddressSerializer` should be
shown like following as a request body:

```
tenant: integer ...
```

while it should be shown like following as a response body:

```
tenant: {
    id: integer ...,
    url: string ...,
    name: string ...,
    slug: string ...
}
```

But in both cases, it is shown as a response body type expression. This
causes an error at sending an API request with that type value.

It is only an API view issue, API can handle a request if a request
parameter is structured as an expected request body by ignoring the
wrong expression.

This fixes the issue by replacing an implicitly used default auto schema
generator class by its sub class and returning a pseudo serializer with
'Writable' prefix at generating a request body. The reason to introduce
a new generator class is that there is no other point which can
distinguish a request and a response. It is not enough to distinguish
POST, PUT, PATCH methods from GET because former cases may return a JSON
object as a response but it is also represented as same as a request
body, causes another mismatch.

This also fixes `SerializedPKRelatedField` type field representation. It
should be shown as an array of primary keys in a request body.

Fixed #2400
2018-11-27 16:14:45 -05:00
Jeremy Stretch
bd7aee7c1f Closes #2614: Simplify calls of super() for Python 3 2018-11-27 10:52:24 -05:00
Jeremy Stretch
7d8ae5e763 Fixes #2609: Fixed exception when ChoiceField integer value is passed as a string 2018-11-26 14:05:57 -05:00
Jeremy Stretch
2bae50f501 Enforce consistent ordering of value/label keys for ChoiceField 2018-11-26 14:02:38 -05:00
John Anderson
fd9b2f2fda cleanup component filters and UI filter forms for device and device type - #2583 2018-11-15 00:42:01 -05:00
John Anderson
3c0181ef35 added logic to append &type=physical to interface API query for cable creation - #2585 2018-11-14 23:35:15 -05:00
Jeremy Stretch
63bd48003e Clean up cable termination types 2018-11-14 12:17:18 -05:00
Jeremy Stretch
bc8dbfde7c Merge branch 'develop' into develop-2.5 2018-11-12 16:03:52 -05:00
Jeremy Stretch
0c33af2140 Fixes #2558: Filter on all tags when multiple are passed 2018-11-12 15:48:58 -05:00
Jeremy Stretch
bb5432de7d PEP8 fix 2018-11-08 11:13:03 -05:00
Jeremy Stretch
338ce737c8 Removed deprecated expand_numeric_pattern() 2018-11-06 15:39:38 -05:00
Jeremy Stretch
f41f141130 Removed unused class NullableModelMultipleChoiceField 2018-11-06 15:32:59 -05:00
Jeremy Stretch
9f0169286b Standardize usage of NaturalOrderingManager 2018-11-06 14:05:23 -05:00
Jeremy Stretch
045856c9ac Introduced a placeholder template filter 2018-11-05 13:00:46 -05:00
Juho Juopperi
319869c22e Update django is_safe_url calls to new API (#2546) 2018-11-05 08:52:00 -05:00
Jeremy Stretch
f8a961b568 Cleaned up import statements 2018-11-02 15:20:08 -04:00
Jeremy Stretch
521a989d23 Removed Python2 hack 2018-11-02 14:59:48 -04:00
Jeremy Stretch
b05171b126 Upgraded django-tables2 to v2.0.2 2018-11-02 14:27:17 -04:00
Jeremy Stretch
bb5c0989f3 Fixed compatability with Django REST Framework v3.9.0 2018-11-02 13:16:44 -04:00
Jeremy Stretch
ad03a0925b Fixed cable type filtering 2018-11-01 10:18:37 -04:00
Jeremy Stretch
5e7fccb64e Add blank choice to ColorSelect widget 2018-11-01 10:14:47 -04:00
Jeremy Stretch
849db8fe44 Finished CableCSVForm 2018-11-01 09:59:53 -04:00
Jeremy Stretch
33cdecbc52 Remove errant print() statement 2018-10-26 14:06:27 -04:00
Jeremy Stretch
83dec3b587 Fixed color display 2018-10-26 13:14:12 -04:00
Jeremy Stretch
3518d023dc Implemented Cable API endpoint 2018-10-26 12:25:11 -04:00
Jeremy Stretch
6bea8cc546 Added length and length_unit fields to Cable 2018-10-26 10:28:25 -04:00
Jeremy Stretch
35f80f5085 First stab at cable path tracing and automatic endpoint connections 2018-10-24 16:17:01 -04:00
Jeremy Stretch
471bddea09 WIP: Initial work on the cable connection form 2018-10-22 16:58:24 -04:00
Jeremy Stretch
a36b120c8b Merge branch 'develop-2.5' into 20-physical-cabling 2018-10-19 13:34:21 -04:00
Jeremy Stretch
22ed4f1b53 Merge release v2.4.6 2018-10-10 09:36:51 -04:00
Jeremy Stretch
4c37628784 Fixes #2393: Fix Unicode support for CSV import under Python 2 2018-10-05 15:33:29 -04:00
Jeremy Stretch
bf47e7cae3 #2487: Require the 'brief' parameter to evaluate True 2018-10-04 14:50:57 -04:00
Jeremy Stretch
db2721c581 Enable brief API output utilizing nested serializers 2018-10-04 13:43:50 -04:00
Jeremy Stretch
3eddeeadc5 Initial work on #20 - patch panels 2018-10-03 14:04:16 -04:00
Jeremy Stretch
364bbdeab8 Merged release v2.4.5 2018-10-03 11:23:21 -04:00
Jeremy Stretch
15babeb584 Fixes #2414: Tags field missing from device/VM component creation forms 2018-09-28 16:26:08 -04:00
Jeremy Stretch
020b5ea870 Fixes #2470: Log the creation of device/VM components as object changes 2018-09-28 16:04:51 -04:00
Jeremy Stretch
292647da14 Closes #2402: Order and format JSON data in form fields 2018-09-13 11:31:34 -04:00
Jeremy Stretch
2ac60bdf48 Merge branch 'develop' into develop-2.5 (v2.4.4 release) 2018-08-22 12:10:44 -04:00
Jeremy Stretch
e1e41a768a Fixes #2369: Corrected time zone validation on site API serializer 2018-08-20 16:53:23 -04:00
Jeremy Stretch
7145f86a6e #2359: Extended exempt attributes to 'migrate' command 2018-08-15 15:02:58 -04:00
Jeremy Stretch
7ec4155845 Closes #2359: Implement custom makemigrations command to ignore extraneous field attributes 2018-08-15 14:18:52 -04:00
Jeremy Stretch
980d62d579 Removed Python 2 string compatibility 2018-08-14 11:58:42 -04:00
Jeremy Stretch
ac546a9711 Closes #2000: Remove support for Python 2 2018-08-14 11:48:12 -04:00
Jeremy Stretch
a2ff21fab9 Fixes #2334: TypeError raised when WritableNestedSerializer receives a non-integer value 2018-08-08 15:09:30 -04:00