archesproject / arches

Arches is a web platform for creating, managing, & visualizing geospatial data. Arches was inspired by the needs of the Cultural Heritage community, particularly the widespread need of organizations to build & manage cultural heritage inventories
GNU Affero General Public License v3.0
212 stars 142 forks source link

Add language support into DB functions and model tests and validation #11013

Closed aj-he closed 3 months ago

aj-he commented 4 months ago

Types of changes

Description of Change

Updates to spatialview database functions for language support and improved testing/validation

Issues Solved

Closes #10705

Checklist

Accessibility Checklist

Developer Guide

Topic Changed Retested
Color contrast
Form fields
Headings
Links
Keyboard
Responsive Design
HTML validation
Screen reader

Ticket Background

Further comments

This change is in combination with #10704, which added language code to the Spatialview model and is providing an API to manage them outside django admin.

aj-he commented 4 months ago

@whatisgalen I have no idea why all these checks are failing as the migrations all work as expected on my local machine?

jacobtylerwalls commented 4 months ago

Hey Andy. The check is saying there's a "missing" migration, so you just need to run makemigrations.

aj-he commented 4 months ago

@whatisgalen please wait before looking at this as @jacobtylerwalls is investigating how we should be using TransactionTestCase. I'll remove you as reviewer until ready

jacobtylerwalls commented 4 months ago

Hey all. I followed up on Slack, but basically we can just add serialized_rollback = True and everything should work without having to manually manage the truncation (modulo a couple changes to the user signals). You can borrow what you need from d7c1f60f2f7ec31a355b7ddce29ca5c5ba9eba50, I hope?

aj-he commented 3 months ago

@jacobtylerwalls I've implemented the serialized_rollback = True approach and remove all the class methods, which works in isolation. However, the tests/bulkdata/single_csv_tests.py test is causing an issue, even with the changes you made in the commit you reference (move code out of the class methods and modify).

The error refers to missing ContentType, which makes me think that truncation is occurring prematurely... django.contrib.contenttypes.models.ContentType.DoesNotExist: ContentType matching query does not exist.

If I remove the single_csv_tests TransactionTestCase then it works fine.

jacobtylerwalls commented 3 months ago

Hey @aj-he. That's the failure I see when I don't include the changes to the save_profile() and create_permissions_for_new_users() signals in that commit. Just checking that you included those changes as well?

aj-he commented 3 months ago

@jacobtylerwalls - yep, that was it! I didn't pick up on those signal tweaks. This branch has gotten a bit dirty so I'm going to close this PR and rebase tidying up. It also depends on your commits mentioned so will need to wait for those to go through. Thanks