Skip to content

DiamondBase - Upgrade#2

Open
jbopp wants to merge 10 commits intomwalsh161:masterfrom
jbopp:master
Open

DiamondBase - Upgrade#2
jbopp wants to merge 10 commits intomwalsh161:masterfrom
jbopp:master

Conversation

@jbopp
Copy link
Copy Markdown

@jbopp jbopp commented Feb 18, 2020

DiamondBase is now compatible with Django 3.0.2 and Python 3. Furthermore, Action_Type and Data_Type objects can now be linked to parameters which can be set up dynamically. To make this work, DiamondBase/triggers.sql needs to be incorporated in the SQL database used.

Copy link
Copy Markdown
Author

@jbopp jbopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes which have been made are commented now.

Comment thread DiamondBase/settings.py
'foundation',
'slack',
'about',
'custom_middleware'
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed anymore...

Comment thread DiamondBase/settings.py
'slack',
'about',
'custom_middleware'
'login_required'
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread DiamondBase/settings.py
'login_required'
)

MIDDLEWARE_CLASSES = (
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

Comment thread DiamondBase/settings.py
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'custom_middleware.middleware.LoginRequiredMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS=("django.contrib.auth.context_processors.auth",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrade to Django 3

Comment thread DiamondBase/settings.py

WSGI_APPLICATION = 'DiamondBase.wsgi.application'

LOGIN_URL = '/login/'
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Configuration of login_required plugin

Comment thread sample_database/views.py
try: return redirect(obj.url())
except: pass # If not url method, just return this form
context = RequestContext(request,{'obj':obj,
'obj_fields':fields,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

Comment thread sample_database/views.py

if type == 'Sample':
form.fields["owner"].queryset = User.objects.filter(is_staff=True).order_by('first_name')
elif type != 'Sample' and type != 'Piece':
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

Comment thread sample_database/views.py
obj=False
form=''
prompt=''
editable=['Sample','Piece','Action','General','Local','Local_Attachment']
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same changes as in edit.

Comment thread sample_database/views.py
obj.delete()
try:
obj.delete()
except models.ProtectedError:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show proper error message if object cannot be deleted due to on_delete constraint.

Comment thread sample_database/views.py
type = Data_Type.objects.get(id = attachID)
prompt = 'Filenames will go to notes unless a txt file is supplied. The txt file needs <b>one line per file!</b>'
if request.method == 'POST':
form=ZipForm(type,request.POST,request.FILES)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See sample_database/models.py on how additional parameters are handled now.

Copy link
Copy Markdown
Author

@jbopp jbopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes which have been made are commented now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant