Skip to content

Commit b120d32

Browse files
committed
[qa] Fix merge conflicts and formatting issues
- Resolve remaining git conflict markers in admin.py - Fix whitespace issue in serializers.py - Format rest-api.rst documentation
1 parent a7e3f33 commit b120d32

File tree

3 files changed

+19
-23
lines changed

3 files changed

+19
-23
lines changed

docs/user/rest-api.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ When using this strategy, in the response you can find the field
857857
credentials.
858858

859859
Batch retrieve and update
860-
++++++++++++++++++++++++++
860+
+++++++++++++++++++++++++
861861

862862
.. code-block:: text
863863
@@ -870,16 +870,16 @@ Used to retrieve or update a ``RadiusBatch`` instance.
870870
.. note::
871871

872872
The ``organization`` field is **read-only** for existing batch objects
873-
and cannot be changed via the API. This is intentional as changing
874-
the organization after batch creation would be inconsistent.
873+
and cannot be changed via the API. This is intentional as changing the
874+
organization after batch creation would be inconsistent.
875875

876876
Parameters for **GET**:
877877

878-
===== ===========
878+
===== =================
879879
Param Description
880-
===== ===========
880+
===== =================
881881
id UUID of the batch
882-
===== ===========
882+
===== =================
883883

884884
Parameters for **PUT**/**PATCH** (only certain fields can be updated):
885885

openwisp_radius/admin.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -463,31 +463,31 @@ def delete_selected_batches(self, request, queryset):
463463
)
464464

465465
def get_readonly_fields(self, request, obj=None):
466-
<<<<<<< HEAD
467-
readonly_fields = super(RadiusBatchAdmin, self).get_readonly_fields(
468-
request, obj
469-
)
466+
readonly_fields = super().get_readonly_fields(request, obj)
470467
if obj and obj.status != "pending":
471468
return (
472-
=======
473-
readonly_fields = super().get_readonly_fields(request, obj)
474-
if obj:
475-
return readonly_fields + (
476-
>>>>>>> 1402441 ([admin/api] Make batch user creation organization field readonly #609)
477469
"strategy",
478470
"organization",
479471
"prefix",
480472
"csvfile",
481473
"number_of_users",
482474
"users",
483475
"expiration_date",
484-
<<<<<<< HEAD
485476
"name",
486-
"organization",
487477
"status",
488478
) + readonly_fields
489479
elif obj:
490-
return ("status",) + readonly_fields
480+
# For existing objects with pending status, still make organization readonly
481+
return readonly_fields + (
482+
"strategy",
483+
"organization",
484+
"prefix",
485+
"csvfile",
486+
"number_of_users",
487+
"users",
488+
"expiration_date",
489+
"status",
490+
)
491491
return ("status",) + readonly_fields
492492

493493
def has_delete_permission(self, request, obj=None):
@@ -514,10 +514,6 @@ def response_add(self, request, obj, post_url_continue=None):
514514
else:
515515
self.message_user(request, msg, messages.SUCCESS)
516516
return self.response_post_save_add(request, obj)
517-
=======
518-
)
519-
return readonly_fields
520-
>>>>>>> 1402441 ([admin/api] Make batch user creation organization field readonly #609)
521517

522518

523519
# Inlines for UserAdmin & OrganizationAdmin

openwisp_radius/api/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ def validate(self, data):
475475
"""
476476
# Remove organization_slug from data if provided (should not be changeable)
477477
data.pop("organization_slug", None)
478-
478+
479479
strategy = data.get("strategy") or (self.instance and self.instance.strategy)
480480

481481
if (

0 commit comments

Comments
 (0)