Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOTFIX/3.1.1 #880

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions alyx/actions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,8 @@ class WaterTypeAdmin(BaseActionAdmin):
list_display_links = ('name',)


class SurgeryActionForm(BaseActionForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['implant_weight'].required = True


class SurgeryAdmin(BaseActionAdmin):
form = SurgeryActionForm
form = BaseActionForm
list_display = ['subject_l', 'date', 'users_l', 'procedures_l',
'narrative', 'projects', 'implant_weight']
list_select_related = ('subject',)
Expand Down
19 changes: 19 additions & 0 deletions alyx/actions/migrations/0026_alter_surgery_implant_weight.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 5.1.2 on 2024-11-19 14:14

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('actions', '0025_move_implant_weight'),
]

operations = [
migrations.AlterField(
model_name='surgery',
name='implant_weight',
field=models.FloatField(help_text='Implant weight in grams', validators=[django.core.validators.MinValueValidator(0)]),
),
]
2 changes: 1 addition & 1 deletion alyx/actions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class Surgery(BaseAction):
default=_default_surgery_location,
help_text="The physical location at which the surgery was "
"performed")
implant_weight = models.FloatField(null=False, blank=True, validators=[MinValueValidator(0)],
implant_weight = models.FloatField(null=False, blank=False, validators=[MinValueValidator(0)],
help_text="Implant weight in grams")

class Meta:
Expand Down
2 changes: 1 addition & 1 deletion alyx/alyx/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = __version__ = '3.1.0'
VERSION = __version__ = '3.1.1'
2 changes: 1 addition & 1 deletion alyx/jobs/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def has_change_permission(self, request, obj=None):
if obj:
if obj.session:
# Check if session user or member of the same lab
is_session_user = obj.session.users.users.contains(request.user)
is_session_user = obj.session.users.contains(request.user)
return is_session_user or obj.session.lab.name in request.user.lab
else:
# Check if user is member of the lab associated with the task repository
Expand Down
4 changes: 2 additions & 2 deletions alyx/subjects/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
)
from actions.models import (
Surgery, Session, OtherAction, WaterAdministration, WaterRestriction, Weighing)
from actions.admin import SurgeryActionForm
from actions.admin import BaseActionForm
from misc.models import LabMember, Housing
from misc.admin import NoteInline

Expand Down Expand Up @@ -236,7 +236,7 @@ def has_add_permission(self, request, obj=None):


class AddSurgeryInline(SurgeryInline):
form = SurgeryActionForm
form = BaseActionForm
readonly_fields = ()
show_change_link = False
verbose_name = "New surgery"
Expand Down
Loading