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

Your commit message explaining the changes #1138

Open
wants to merge 1 commit into
base: back-branch-master
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 4 additions & 1 deletion backend/dataset/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import resource
# import resource
import os
# if os.name != 'nt': # 'nt' means Windows
# import resource # Only import resource on non-Windows platforms
from django.contrib import admin
from import_export.admin import ImportExportActionModelAdmin
from .resources import *
Expand Down
61 changes: 61 additions & 0 deletions backend/dataset/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,67 @@ def list(self, request, *args, **kwargs):
dataset_instance["last_upload_result"] = dataset_instance_result

return Response(serializer.data)



# # new optimized code.

# def list(self, request, *args, **kwargs):
# # Org Owners and superusers see all datasets
# if request.user.is_superuser:
# queryset = DatasetInstance.objects.all()
# elif request.user.role == User.ORGANIZATION_OWNER:
# queryset = DatasetInstance.objects.filter(
# organisation_id=request.user.organization
# )
# # Managers only see datasets that they are added to and public datasets
# else:
# queryset = DatasetInstance.objects.filter(
# organisation_id=request.user.organization
# ).filter(Q(public_to_managers=True) | Q(users__id=request.user.id))

# if "dataset_visibility" in request.query_params:
# dataset_visibility = request.query_params["dataset_visibility"]
# if dataset_visibility == "all_public_datasets":
# if (request.user.role == User.WORKSPACE_MANAGER) and (
# request.user.is_superuser == False
# ):
# queryset = queryset.filter(public_to_managers=True)
# elif dataset_visibility == "my_datasets":
# queryset = queryset.filter(users__id=request.user.id)

# # Filter the queryset based on the query params
# if "dataset_type" in dict(request.query_params):
# queryset = queryset.filter(
# dataset_type__exact=request.query_params["dataset_type"]
# )

# # Serialize the distinct items and sort by instance ID
# serializer = DatasetInstanceSerializer(
# queryset.distinct().order_by("instance_id"), many=True
# )

# # Add status fields to the serializer data
# for dataset_instance in serializer.data:
# # Get the task statuses for the dataset instance
# (
# dataset_instance_status,
# dataset_instance_date,
# dataset_instance_time,
# dataset_instance_result,
# ) = get_dataset_upload_status(dataset_instance["instance_id"])

# # Add the task status and time to the dataset instance response
# dataset_instance["last_upload_status"] = dataset_instance_status
# dataset_instance["last_upload_date"] = dataset_instance_date
# dataset_instance["last_upload_time"] = dataset_instance_time
# dataset_instance["last_upload_result"] = dataset_instance_result

# return Response(serializer.data)





@is_organization_owner
@action(methods=["GET"], detail=True, name="Download Dataset in CSV format")
Expand Down
29 changes: 29 additions & 0 deletions backend/shoonya_backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@
# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases

# DATABASES = {
# "default": {
# "ENGINE": "django.db.backends.postgresql",
# "NAME": os.getenv("DB_NAME"),
# "USER": os.getenv("DB_USER"),
# "PASSWORD": os.getenv("DB_PASSWORD"),
# "HOST": os.getenv("DB_HOST"),
# "PORT": os.getenv("DB_PORT"),
# }
# }

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
Expand All @@ -127,6 +138,24 @@
}
}

# print("DB_NAME:", os.getenv("DB_NAME"))
# print("DB_USER:", os.getenv("DB_USER"))
# print("DB_PASSWORD:", os.getenv("DB_PASSWORD"))
# print("DB_HOST:", os.getenv("DB_HOST"))
# print("DB_PORT:", os.getenv("DB_PORT"))


# DATABASES = {
# "default": {
# "ENGINE": "django.db.backends.postgresql",
# "NAME": "postgres",
# "USER": "postgres",
# "PASSWORD": "123",
# "HOST": 'localhost',
# "PORT": '5432',
# }
# }


# Password validation
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright (c) 2013-2023 by the Babel Team, see AUTHORS for more information.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Metadata-Version: 2.1
Name: Babel
Version: 2.12.1
Summary: Internationalization utilities
Home-page: https://babel.pocoo.org/
Author: Armin Ronacher
Author-email: [email protected]
Maintainer: Aarni Koskela
Maintainer-email: [email protected]
License: BSD
Project-URL: Source, https://github.com/python-babel/babel
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.7
License-File: LICENSE
Requires-Dist: pytz (>=2015.7) ; python_version < "3.9"

A collection of tools for internationalizing Python applications.
Loading