Skip to content

Commit

Permalink
populate project owners
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokant committed Jan 9, 2024
1 parent 5294739 commit 0ad29f4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions metadata_catalogue/nina/libs/harvesters.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from typing import Dict

import requests
from django.contrib.auth import get_user_model

from metadata_catalogue.datasets.models import Organization

from ..models import Category, Department, Project

User = get_user_model()


def _fetch_paginated_project(url: str, limit=50):
offset = 0
Expand Down Expand Up @@ -67,6 +70,14 @@ def _process_project(project: dict):

p.save()

if project.get("maintainer_email"):
u, created = User.objects.get_or_create(email=project.get("maintainer_email"))
if created:
u.set_unusable_password()
u.save()

p.get_or_add_user(u)


def prosjektoversikt(url: str, limit=50):
"""
Expand Down

0 comments on commit 0ad29f4

Please sign in to comment.