-
Notifications
You must be signed in to change notification settings - Fork 2
DiamondBase - Upgrade #2
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
base: master
Are you sure you want to change the base?
Conversation
jbopp
left a comment
There was a problem hiding this 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.
| 'foundation', | ||
| 'slack', | ||
| 'about', | ||
| 'custom_middleware' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed anymore...
| 'slack', | ||
| 'about', | ||
| 'custom_middleware' | ||
| 'login_required' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...since login is now managed by https://pypi.org/project/django-login-required-middleware/.
| 'login_required' | ||
| ) | ||
|
|
||
| MIDDLEWARE_CLASSES = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
| 'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
| 'custom_middleware.middleware.LoginRequiredMiddleware', | ||
| ) | ||
| TEMPLATE_CONTEXT_PROCESSORS=("django.contrib.auth.context_processors.auth", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrade to Django 3
|
|
||
| WSGI_APPLICATION = 'DiamondBase.wsgi.application' | ||
|
|
||
| LOGIN_URL = '/login/' |
There was a problem hiding this comment.
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
| try: return redirect(obj.url()) | ||
| except: pass # If not url method, just return this form | ||
| context = RequestContext(request,{'obj':obj, | ||
| 'obj_fields':fields, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
|
|
||
| if type == 'Sample': | ||
| form.fields["owner"].queryset = User.objects.filter(is_staff=True).order_by('first_name') | ||
| elif type != 'Sample' and type != 'Piece': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
| obj=False | ||
| form='' | ||
| prompt='' | ||
| editable=['Sample','Piece','Action','General','Local','Local_Attachment'] |
There was a problem hiding this comment.
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.
| obj.delete() | ||
| try: | ||
| obj.delete() | ||
| except models.ProtectedError: |
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
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.
jbopp
left a comment
There was a problem hiding this 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.
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.