mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-10-31 10:42:43 +00:00 
			
		
		
		
	Set backrefs correctly.
This commit is contained in:
		| @@ -24,16 +24,17 @@ def corpora(corpus): | ||||
| @login_required | ||||
| def dashboard(): | ||||
|     create_corpus_form = CreateCorpusForm() | ||||
|     print(current_user.corpora.all()) | ||||
|     print(current_user.jobs.all()) | ||||
|  | ||||
|     if create_corpus_form.validate_on_submit(): | ||||
|         app = current_app._get_current_object() | ||||
|         corpus = Corpus() | ||||
|         corpus.creation_date = datetime.utcnow() | ||||
|         corpus.description = create_corpus_form.description.data | ||||
|         corpus.title = create_corpus_form.title.data | ||||
|         corpus.user_id = current_user.id | ||||
|         corpus = Corpus(creator=current_user._get_current_object(), | ||||
|                         description=create_corpus_form.description.data, | ||||
|                         title=create_corpus_form.title.data) | ||||
|         db.session.add(corpus) | ||||
|         db.session.commit() | ||||
|  | ||||
|         dir = os.path.join(app.config['OPAQUE_STORAGE'], | ||||
|                            str(corpus.user_id), | ||||
|                            'corpora', | ||||
|   | ||||
| @@ -113,8 +113,8 @@ class User(UserMixin, db.Model): | ||||
|     role_id = db.Column(db.Integer, db.ForeignKey('roles.id')) | ||||
|     username = db.Column(db.String(64), unique=True, index=True) | ||||
|     # Relationships | ||||
|     corpora = db.relationship('Corpus', backref='corpus', lazy='dynamic') | ||||
|     jobs = db.relationship('Job', backref='job', lazy='dynamic') | ||||
|     corpora = db.relationship('Corpus', backref='creator', lazy='dynamic') | ||||
|     jobs = db.relationship('Job', backref='creator', lazy='dynamic') | ||||
|  | ||||
|     def __repr__(self): | ||||
|         """ | ||||
|   | ||||
| @@ -17,19 +17,17 @@ def ocr(): | ||||
|     new_ocr_job_form = NewOCRJobForm() | ||||
|     if new_ocr_job_form.validate_on_submit(): | ||||
|         app = current_app._get_current_object() | ||||
|         ocr_job = Job() | ||||
|         ocr_job.title = new_ocr_job_form.title.data | ||||
|         ocr_job.description = new_ocr_job_form.description.data | ||||
|         ocr_job.user_id = current_user.id | ||||
|         ocr_job.creation_date = datetime.utcnow() | ||||
|         ocr_job.service = "ocr" | ||||
|         ocr_job.ressources = json.dumps({"n_cores": 2, | ||||
|                                          "mem_mb": 4096}) | ||||
|         ocr_job.service_args = json.dumps({"args": ["--keep-intermediates", | ||||
|         ocr_job = Job(creator=current_user._get_current_object(), | ||||
|                       description=new_ocr_job_form.description.data, | ||||
|                       service="ocr", | ||||
|                       ressources=json.dumps({"n_cores": 2, | ||||
|                                              "mem_mb": 4096}), | ||||
|                       service_args=json.dumps({"args": ["--keep-intermediates", | ||||
|                                                         "--skip-binarisation"], | ||||
|                                                "lang": new_ocr_job_form.language.data, | ||||
|                                            "version": new_ocr_job_form.version.data}) | ||||
|         ocr_job.status = "queued" | ||||
|                                                "version": new_ocr_job_form.version.data}), | ||||
|                       status="queued", | ||||
|                       title=new_ocr_job_form.title.data) | ||||
|         db.session.add(ocr_job) | ||||
|         db.session.commit() | ||||
|  | ||||
| @@ -69,18 +67,16 @@ def nlp(): | ||||
|     new_nlp_job_form = NewNLPJobForm() | ||||
|     if new_nlp_job_form.validate_on_submit(): | ||||
|         app = current_app._get_current_object() | ||||
|         nlp_job = Job() | ||||
|         nlp_job.title = new_nlp_job_form.title.data | ||||
|         nlp_job.description = new_nlp_job_form.description.data | ||||
|         nlp_job.user_id = current_user.id | ||||
|         nlp_job.creation_date = datetime.utcnow() | ||||
|         nlp_job.service = "nlp" | ||||
|         nlp_job.ressources = json.dumps({"n_cores": 2, | ||||
|                                          "mem_mb": 4096}) | ||||
|         nlp_job.service_args = json.dumps({"args": [], | ||||
|         nlp_job = Job(creator=current_user._get_current_object(), | ||||
|                       description=new_nlp_job_form.description.data, | ||||
|                       service="nlp", | ||||
|                       ressources=json.dumps({"n_cores": 1, | ||||
|                                              "mem_mb": 2048}), | ||||
|                       service_args=json.dumps({"args": [], | ||||
|                                                "lang": new_nlp_job_form.language.data, | ||||
|                                            "version": new_nlp_job_form.version.data}) | ||||
|         nlp_job.status = "queued" | ||||
|                                                "version": new_nlp_job_form.version.data}), | ||||
|                       status="queued", | ||||
|                       title=new_nlp_job_form.title.data) | ||||
|         db.session.add(nlp_job) | ||||
|         db.session.commit() | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user