Commit 6d0ab091 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

TODO: get_namespaces_redmine

parent 40de2793
......@@ -18,9 +18,10 @@ class Command(BaseCommand):
logger.info(f'updating licenses')
for data in requests.get(LICENSES).json()['licenses']:
logger.info(f' updating license {data["name"]}')
License.objects.get_or_create(spdx_id=data['licenseId'],
defaults={'name': data['name'], 'url': data['detailsUrl']})
instance, created = License.objects.get_or_create(spdx_id=data['licenseId'], defaults={
'name': data['name'], 'url': data['detailsUrl']})
if created:
logger.info(f' creating license {data["name"]}')
# for data in requests.get(f'{github.api_url()}/licenses', headers=github.headers()).json():
# logger.info(f' updating license {data["name"]}')
# License.objects.get_or_create(spdx_id=data['spdx_id'],
......@@ -36,5 +37,5 @@ class Command(BaseCommand):
logger.info(f' updating {repo}')
repo.api_update()
logger.info(f'removing unwanted projects')
Project.objects.filter(main_namespace__group=False).delete()
logger.info(f'removing unwanted projects:')
logger.info(str(Project.objects.filter(main_namespace__group=False).delete()))
......@@ -108,6 +108,9 @@ class Forge(Links, NamedModel):
for data in self.api_list('/users'):
Namespace.objects.get_or_create(slug=data['username'], defaults={'name': data['name']})
def get_namespaces_redmine(self):
pass # TODO
def get_projects(self):
getattr(self, f'get_namespaces_{self.get_source_display()}')()
return getattr(self, f'get_projects_{self.get_source_display()}')()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment