Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
eb146bfc
Commit
eb146bfc
authored
Feb 06, 2019
by
Luis Ernesto Dominguez Uriostegui
Browse files
Options
Browse Files
Download
Plain Diff
Cambios realizados a dataRetrieval, db, migratios, Ulises
parents
9c0ca0a5
f98a7eee
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
189 additions
and
39 deletions
+189
-39
settings.py
GeoInt_SIDT/settings.py
+1
-1
0011_auto_20190206_1555.py
catalog/migrations/0011_auto_20190206_1555.py
+69
-0
0012_auto_20190206_1843.py
catalog/migrations/0012_auto_20190206_1843.py
+43
-0
models.py
catalog/models.py
+38
-36
dataRetrieval.js
catalog/static/catalog/js/dataRetrieval.js
+5
-1
views.py
catalog/views.py
+33
-1
No files found.
GeoInt_SIDT/settings.py
View file @
eb146bfc
...
@@ -122,7 +122,7 @@ AUTH_PASSWORD_VALIDATORS = [
...
@@ -122,7 +122,7 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE
=
'en-us'
LANGUAGE_CODE
=
'en-us'
TIME_ZONE
=
'UTC'
TIME_ZONE
=
'UTC'
...
...
catalog/migrations/0011_auto_20190206_1555.py
0 → 100644
View file @
eb146bfc
# Generated by Django 2.0.5 on 2019-02-06 15:55
from
django.conf
import
settings
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
migrations
.
swappable_dependency
(
settings
.
AUTH_USER_MODEL
),
(
'catalog'
,
'0010_process'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Purchase'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'productList'
,
models
.
TextField
(
verbose_name
=
'JSON Product List'
)),
(
'purchased'
,
models
.
BooleanField
(
default
=
False
)),
(
'price'
,
models
.
FloatField
(
default
=
0.0
)),
],
),
migrations
.
CreateModel
(
name
=
'Search'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'startDate'
,
models
.
DateTimeField
(
verbose_name
=
'Start Date'
)),
(
'endDate'
,
models
.
DateTimeField
(
verbose_name
=
'End Date'
)),
(
'clouds'
,
models
.
IntegerField
(
default
=
4
)),
],
),
migrations
.
RenameField
(
model_name
=
'process'
,
old_name
=
'tag'
,
new_name
=
'name'
,
),
migrations
.
AddField
(
model_name
=
'process'
,
name
=
'platform'
,
field
=
models
.
ForeignKey
(
default
=
''
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'catalog.Platform'
),
),
migrations
.
AddField
(
model_name
=
'process'
,
name
=
'productLevel'
,
field
=
models
.
CharField
(
default
=
''
,
max_length
=
8
),
),
migrations
.
AddField
(
model_name
=
'search'
,
name
=
'process'
,
field
=
models
.
ForeignKey
(
default
=
''
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'catalog.Process'
),
),
migrations
.
AddField
(
model_name
=
'search'
,
name
=
'user'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
settings
.
AUTH_USER_MODEL
),
),
migrations
.
AddField
(
model_name
=
'purchase'
,
name
=
'search'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'catalog.Search'
),
),
migrations
.
AddField
(
model_name
=
'purchase'
,
name
=
'user'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
settings
.
AUTH_USER_MODEL
),
),
]
catalog/migrations/0012_auto_20190206_1843.py
0 → 100644
View file @
eb146bfc
# Generated by Django 2.1.5 on 2019-02-06 18:43
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'catalog'
,
'0011_auto_20190206_1555'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'polygon'
,
name
=
'name'
,
field
=
models
.
CharField
(
max_length
=
100
,
verbose_name
=
'Polygon Name'
),
),
migrations
.
AlterField
(
model_name
=
'polygon'
,
name
=
'source'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
,
verbose_name
=
'Source'
),
),
migrations
.
AlterField
(
model_name
=
'product_l1c'
,
name
=
'file_path'
,
field
=
models
.
CharField
(
max_length
=
150
),
),
migrations
.
AlterField
(
model_name
=
'product_l1c'
,
name
=
'identifier'
,
field
=
models
.
CharField
(
max_length
=
100
),
),
migrations
.
AlterField
(
model_name
=
'product_l2a'
,
name
=
'file_path'
,
field
=
models
.
CharField
(
max_length
=
150
),
),
migrations
.
AlterField
(
model_name
=
'product_l2a'
,
name
=
'identifier'
,
field
=
models
.
CharField
(
max_length
=
100
),
),
]
catalog/models.py
View file @
eb146bfc
...
@@ -8,61 +8,63 @@ from django.db import models
...
@@ -8,61 +8,63 @@ from django.db import models
class
Platform
(
models
.
Model
):
class
Platform
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
64
)
name
=
models
.
CharField
(
max_length
=
64
)
acronym
=
models
.
CharField
(
max_length
=
16
)
acronym
=
models
.
CharField
(
max_length
=
16
)
class
Polygon
(
models
.
Model
):
class
Polygon
(
models
.
Model
):
name
=
models
.
CharField
(
verbose_name
=
"Polygon Name"
,
max_length
=
5
0
)
name
=
models
.
CharField
(
verbose_name
=
"Polygon Name"
,
max_length
=
10
0
)
json_info
=
models
.
TextField
(
verbose_name
=
"JSON Info"
)
json_info
=
models
.
TextField
(
verbose_name
=
"JSON Info"
)
description
=
models
.
TextField
(
verbose_name
=
"Description"
,
null
=
True
)
description
=
models
.
TextField
(
verbose_name
=
"Description"
,
null
=
True
)
source
=
models
.
CharField
(
verbose_name
=
"Source"
,
max_length
=
5
0
,
null
=
True
)
source
=
models
.
CharField
(
verbose_name
=
"Source"
,
max_length
=
10
0
,
null
=
True
)
CVE_ENT
=
models
.
CharField
(
verbose_name
=
"State Key"
,
max_length
=
10
,
null
=
True
)
CVE_ENT
=
models
.
CharField
(
verbose_name
=
"State Key"
,
max_length
=
10
,
null
=
True
)
CVE_MUN
=
models
.
CharField
(
verbose_name
=
"City Key"
,
max_length
=
10
,
null
=
True
)
CVE_MUN
=
models
.
CharField
(
verbose_name
=
"City Key"
,
max_length
=
10
,
null
=
True
)
CVE_LOC
=
models
.
CharField
(
verbose_name
=
"Location Key"
,
max_length
=
10
,
null
=
True
)
CVE_LOC
=
models
.
CharField
(
verbose_name
=
"Location Key"
,
max_length
=
10
,
null
=
True
)
CVE_AGEB
=
models
.
CharField
(
verbose_name
=
"AGEB Key"
,
max_length
=
10
,
null
=
True
)
CVE_AGEB
=
models
.
CharField
(
verbose_name
=
"AGEB Key"
,
max_length
=
10
,
null
=
True
)
E_ENT
=
models
.
CharField
(
verbose_name
=
"State Stratum"
,
max_length
=
10
,
null
=
True
)
E_ENT
=
models
.
CharField
(
verbose_name
=
"State Stratum"
,
max_length
=
10
,
null
=
True
)
E_MUN
=
models
.
CharField
(
verbose_name
=
"City Stratum"
,
max_length
=
10
,
null
=
True
)
E_MUN
=
models
.
CharField
(
verbose_name
=
"City Stratum"
,
max_length
=
10
,
null
=
True
)
E_AGEB
=
models
.
CharField
(
verbose_name
=
"AGEB Stratum"
,
max_length
=
10
,
null
=
True
)
E_AGEB
=
models
.
CharField
(
verbose_name
=
"AGEB Stratum"
,
max_length
=
10
,
null
=
True
)
wkt_polygon
=
models
.
TextField
(
null
=
True
)
wkt_polygon
=
models
.
TextField
(
null
=
True
)
class
Product_l1c
(
models
.
Model
):
class
Product_l1c
(
models
.
Model
):
uuid
=
models
.
CharField
(
max_length
=
50
)
uuid
=
models
.
CharField
(
max_length
=
50
)
identifier
=
models
.
CharField
(
max_length
=
5
0
)
identifier
=
models
.
CharField
(
max_length
=
10
0
)
file_path
=
models
.
CharField
(
max_length
=
50
)
file_path
=
models
.
CharField
(
max_length
=
1
50
)
json
=
models
.
TextField
(
null
=
True
)
json
=
models
.
TextField
(
null
=
True
)
class
Product_l2a
(
models
.
Model
):
class
Product_l2a
(
models
.
Model
):
prod_l1c
=
models
.
ForeignKey
(
Product_l1c
,
on_delete
=
models
.
CASCADE
)
prod_l1c
=
models
.
ForeignKey
(
Product_l1c
,
on_delete
=
models
.
CASCADE
)
identifier
=
models
.
CharField
(
max_length
=
5
0
)
identifier
=
models
.
CharField
(
max_length
=
10
0
)
file_path
=
models
.
CharField
(
max_length
=
50
)
file_path
=
models
.
CharField
(
max_length
=
1
50
)
class
CartProduct
(
models
.
Model
):
class
CartProduct
(
models
.
Model
):
user
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
user
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
uuid
=
models
.
CharField
(
max_length
=
50
)
uuid
=
models
.
CharField
(
max_length
=
50
)
aggreg_date
=
models
.
DateTimeField
(
auto_now
=
True
)
## date of product aggregation
aggreg_date
=
models
.
DateTimeField
(
auto_now
=
True
)
## date of product aggregation
info
=
models
.
TextField
(
null
=
True
)
info
=
models
.
TextField
(
null
=
True
)
purchased
=
models
.
NullBooleanField
()
purchased
=
models
.
NullBooleanField
()
#-------------------------------------------------------------------------------------------
#
-------------------------------------------------------------------------------------------
class
Process
(
models
.
Model
):
class
Process
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
)
name
=
models
.
CharField
(
max_length
=
50
)
platform
=
models
.
ForeignKey
(
Platform
,
on_delete
=
models
.
CASCADE
,
default
=
''
)
platform
=
models
.
ForeignKey
(
Platform
,
on_delete
=
models
.
CASCADE
,
default
=
''
)
productLevel
=
models
.
CharField
(
max_length
=
8
,
default
=
''
)
productLevel
=
models
.
CharField
(
max_length
=
8
,
default
=
''
)
class
Search
(
models
.
Model
):
class
Search
(
models
.
Model
):
user
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
user
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
startDate
=
models
.
DateTimeField
(
verbose_name
=
'Start Date'
)
startDate
=
models
.
DateTimeField
(
verbose_name
=
'Start Date'
)
endDate
=
models
.
DateTimeField
(
verbose_name
=
'End Date'
)
endDate
=
models
.
DateTimeField
(
verbose_name
=
'End Date'
)
process
=
models
.
ForeignKey
(
Process
,
on_delete
=
models
.
CASCADE
,
default
=
''
)
process
=
models
.
ForeignKey
(
Process
,
on_delete
=
models
.
CASCADE
,
default
=
''
)
clouds
=
models
.
IntegerField
(
default
=
4
)
clouds
=
models
.
IntegerField
(
default
=
4
)
class
Purchase
(
models
.
Model
):
class
Purchase
(
models
.
Model
):
user
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
user
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
search
=
models
.
ForeignKey
(
Search
,
on_delete
=
models
.
CASCADE
)
search
=
models
.
ForeignKey
(
Search
,
on_delete
=
models
.
CASCADE
)
productList
=
models
.
TextField
(
verbose_name
=
"JSON Product List"
)
productList
=
models
.
TextField
(
verbose_name
=
"JSON Product List"
)
purchased
=
models
.
BooleanField
(
default
=
False
)
purchased
=
models
.
BooleanField
(
default
=
False
)
price
=
models
.
FloatField
(
default
=
0.0
)
price
=
models
.
FloatField
(
default
=
0.0
)
catalog/static/catalog/js/dataRetrieval.js
View file @
eb146bfc
...
@@ -484,7 +484,11 @@ $(document).ready(function () {
...
@@ -484,7 +484,11 @@ $(document).ready(function () {
url
:
purch_prod_url
,
url
:
purch_prod_url
,
data
:
{
data
:
{
'csrfmiddlewaretoken'
:
document
.
getElementsByName
(
'csrfmiddlewaretoken'
)[
0
].
value
,
'csrfmiddlewaretoken'
:
document
.
getElementsByName
(
'csrfmiddlewaretoken'
)[
0
].
value
,
'product_objects'
:
JSON
.
stringify
(
productObject
)
'product_objects'
:
JSON
.
stringify
(
productObject
),
'wkt'
:
$
(
"#product-form input[name=polygon]"
).
val
(),
'startDate'
:
$
(
"#product-form input[name=start]"
).
val
(),
'endDate'
:
$
(
"#product-form input[name=end]"
).
val
(),
'clouds'
:
$
(
"#product-form input[name=cloudPercentage]"
).
val
(),
},
},
dataType
:
'json'
dataType
:
'json'
});
});
...
...
catalog/views.py
View file @
eb146bfc
...
@@ -251,7 +251,39 @@ def purchaseProduct(request):
...
@@ -251,7 +251,39 @@ def purchaseProduct(request):
"""
"""
For now to purchase a product consists in verifying whether L1C products in cart already exist in DB.
For now to purchase a product consists in verifying whether L1C products in cart already exist in DB.
"""
"""
# ------------- crear archivo findProducts.json
print
(
"Comprar productos!!!!"
)
print
(
request
)
print
(
"start date:"
)
print
(
request
.
POST
[
'wkt'
])
print
(
request
.
POST
[
'startDate'
])
print
(
request
.
POST
[
'endDate'
])
print
(
request
.
POST
[
'clouds'
])
#obtiene los datos para el json
data
=
{}
data
[
'wkt'
]
=
request
.
POST
[
'wkt'
]
data
[
'platform'
]
=
'Sentinel-2'
data
[
'productLevel'
]
=
'L2A'
data
[
'startDate'
]
=
request
.
POST
[
'startDate'
]
data
[
'endDate'
]
=
request
.
POST
[
'endDate'
]
data
[
'clouds'
]
=
request
.
POST
[
'clouds'
]
data
[
'productsDir'
]
=
'/home/david/NAS/sentinelImages/L2A/'
data
[
'linksDir'
]
=
'/home/david/centroGEO/repsat/tests/L2A/'
data
[
'username'
]
=
'mario-chirinos'
data
[
'password'
]
=
'r4nc0r4u'
#json_data = json.dumps(data, indent=4,sort_keys=True)
#formatea el json
json_data
=
json
.
dumps
(
data
,
indent
=
4
)
print
(
json_data
)
#escribe el json en el archivo
fidProductsFile
=
open
(
"/home/david/centroGEO/repsat/GeoInt_SIDT/findProducts.json"
,
"w"
)
fidProductsFile
.
write
(
json_data
)
fidProductsFile
.
close
()
#-------------------------------------------------
products
=
json
.
loads
(
request
.
POST
[
'product_objects'
])
products
=
json
.
loads
(
request
.
POST
[
'product_objects'
])
orderedProducts
=
OrderedDict
()
orderedProducts
=
OrderedDict
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment