Repository: jazzband/django-simple-history

Issue:
Setting app_label different to model class 
Am I completely missing something or can you only set the **_app_label_** via the register method passing app='some_app'?
I have tried:
history = HistoricalRecords(inherit=False)
   and
history = HistoricalRecords(inherit=True)

... but the app_label in the generated history model is always the same as the model it is created from.
Have traversed the code and see no obvious way to change the generated history model to use a different app_lable than the model from which it is created when creating the history model using the history = HistoricalRecords() mechanism.

This does work:
 register(MyModel, app='some_other_app', inherit=False)


Discussion:
You're right. You can only set the app_label of the historical model to be different than the base model using the `register` method. Feel free to add a PR to fix this. Thanks!

Resolving patch:
diff --git a/simple_history/models.py b/simple_history/models.py
--- a/simple_history/models.py
+++ b/simple_history/models.py
@@ -50,6 +50,7 @@ def __init__(
         get_user=default_get_user,
         cascade_delete_history=False,
         custom_model_name=None,
+        app=None,
     ):
         self.user_set_verbose_name = verbose_name
         self.user_related_name = user_related_name
@@ -61,6 +62,7 @@ def __init__(
         self.get_user = get_user
         self.cascade_delete_history = cascade_delete_history
         self.custom_model_name = custom_model_name
+        self.app = app
         if excluded_fields is None:
             excluded_fields = []
         self.excluded_fields = excluded_fields
@@ -340,6 +342,8 @@ def get_meta_options(self, model):
         else:
             name = format_lazy("historical {}", smart_text(model._meta.verbose_name))
         meta_fields["verbose_name"] = name
+        if self.app:
+            meta_fields["app_label"] = self.app
         return meta_fields
 
     def post_save(self, instance, created, **kwargs):


Test patch:
diff --git a/simple_history/registry_tests/tests.py b/simple_history/registry_tests/tests.py
--- a/simple_history/registry_tests/tests.py
+++ b/simple_history/registry_tests/tests.py
@@ -28,6 +28,7 @@
     UUIDRegisterModel,
     Voter,
     ModelWithCustomAttrForeignKey,
+    ModelWithHistoryInDifferentApp,
 )
 
 get_model = apps.get_model
@@ -211,3 +212,11 @@ def test_migrate_command(self):
         management.call_command(
             "migrate", "migration_test_app", fake=True, stdout=StringIO()
         )
+
+
+class TestModelWithHistoryInDifferentApp(TestCase):
+    """ https://github.com/treyhunner/django-simple-history/issues/485 """
+
+    def test__different_app(self):
+        appLabel = ModelWithHistoryInDifferentApp.history.model._meta.app_label
+        self.assertEqual(appLabel, "external")
diff --git a/simple_history/tests/models.py b/simple_history/tests/models.py
--- a/simple_history/tests/models.py
+++ b/simple_history/tests/models.py
@@ -356,6 +356,11 @@ class ContactRegister(models.Model):
 register(ContactRegister, table_name="contacts_register_history")
 
 
+class ModelWithHistoryInDifferentApp(models.Model):
+    name = models.CharField(max_length=30)
+    history = HistoricalRecords(app="external")
+
+
 ###############################################################################
 #
 # Inheritance examples