mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-31 10:37:12 -04:00 
			
		
		
		
	Merge pull request #1463 from paperless-ngx/fix/issue-1462
Fix: Add missing filter rule types to SavedViewFilterRule model & fix migrations
This commit is contained in:
		
						commit
						8046a6f3a7
					
				| @ -1,3 +1,4 @@ | ||||
| // These correspond to src/documents/models.py and changes here require a DB migration (and vice versa)
 | ||||
| export const FILTER_TITLE = 0 | ||||
| export const FILTER_CONTENT = 1 | ||||
| 
 | ||||
|  | ||||
| @ -1,4 +1,6 @@ | ||||
| from django.db import migrations, models | ||||
| import django.utils.timezone | ||||
| from django.conf import settings | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| @ -19,10 +21,49 @@ class Migration(migrations.Migration): | ||||
|                         verbose_name="ID", | ||||
|                     ), | ||||
|                 ), | ||||
|                 ("comment", models.TextField()), | ||||
|                 ("created", models.DateTimeField(auto_now_add=True)), | ||||
|                 ("document_id", models.PositiveIntegerField()), | ||||
|                 ("user_id", models.PositiveIntegerField()), | ||||
|                 ( | ||||
|                     "comment", | ||||
|                     models.TextField( | ||||
|                         blank=True, | ||||
|                         help_text="Comment for the document", | ||||
|                         verbose_name="content", | ||||
|                     ), | ||||
|                 ), | ||||
|                 ( | ||||
|                     "created", | ||||
|                     models.DateTimeField( | ||||
|                         db_index=True, | ||||
|                         default=django.utils.timezone.now, | ||||
|                         verbose_name="created", | ||||
|                     ), | ||||
|                 ), | ||||
|                 ( | ||||
|                     "document", | ||||
|                     models.ForeignKey( | ||||
|                         blank=True, | ||||
|                         null=True, | ||||
|                         on_delete=django.db.models.deletion.CASCADE, | ||||
|                         related_name="documents", | ||||
|                         to="documents.document", | ||||
|                         verbose_name="document", | ||||
|                     ), | ||||
|                 ), | ||||
|                 ( | ||||
|                     "user", | ||||
|                     models.ForeignKey( | ||||
|                         blank=True, | ||||
|                         null=True, | ||||
|                         on_delete=django.db.models.deletion.SET_NULL, | ||||
|                         related_name="users", | ||||
|                         to=settings.AUTH_USER_MODEL, | ||||
|                         verbose_name="user", | ||||
|                     ), | ||||
|                 ), | ||||
|             ], | ||||
|         ) | ||||
|             options={ | ||||
|                 "verbose_name": "comment", | ||||
|                 "verbose_name_plural": "comments", | ||||
|                 "ordering": ("created",), | ||||
|             }, | ||||
|         ), | ||||
|     ] | ||||
|  | ||||
| @ -6,7 +6,7 @@ from django.db import migrations, models | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ("documents", "1022_paperlesstask"), | ||||
|         ("documents", "1023_add_comments"), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
| @ -1,13 +0,0 @@ | ||||
| # Generated by Django 4.0.6 on 2022-08-24 13:41 | ||||
| 
 | ||||
| from django.db import migrations | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ("documents", "1023_add_comments"), | ||||
|         ("documents", "1023_document_original_filename"), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [] | ||||
| @ -0,0 +1,48 @@ | ||||
| # Generated by Django 4.0.5 on 2022-08-26 16:49 | ||||
| 
 | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ("documents", "1024_document_original_filename"), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.AlterField( | ||||
|             model_name="savedviewfilterrule", | ||||
|             name="rule_type", | ||||
|             field=models.PositiveIntegerField( | ||||
|                 choices=[ | ||||
|                     (0, "title contains"), | ||||
|                     (1, "content contains"), | ||||
|                     (2, "ASN is"), | ||||
|                     (3, "correspondent is"), | ||||
|                     (4, "document type is"), | ||||
|                     (5, "is in inbox"), | ||||
|                     (6, "has tag"), | ||||
|                     (7, "has any tag"), | ||||
|                     (8, "created before"), | ||||
|                     (9, "created after"), | ||||
|                     (10, "created year is"), | ||||
|                     (11, "created month is"), | ||||
|                     (12, "created day is"), | ||||
|                     (13, "added before"), | ||||
|                     (14, "added after"), | ||||
|                     (15, "modified before"), | ||||
|                     (16, "modified after"), | ||||
|                     (17, "does not have tag"), | ||||
|                     (18, "does not have ASN"), | ||||
|                     (19, "title or content contains"), | ||||
|                     (20, "fulltext query"), | ||||
|                     (21, "more like this"), | ||||
|                     (22, "has tags in"), | ||||
|                     (23, "ASN greater than"), | ||||
|                     (24, "ASN less than"), | ||||
|                     (25, "storage path is"), | ||||
|                 ], | ||||
|                 verbose_name="rule type", | ||||
|             ), | ||||
|         ), | ||||
|     ] | ||||
| @ -404,6 +404,9 @@ class SavedViewFilterRule(models.Model): | ||||
|         (20, _("fulltext query")), | ||||
|         (21, _("more like this")), | ||||
|         (22, _("has tags in")), | ||||
|         (23, _("ASN greater than")), | ||||
|         (24, _("ASN less than")), | ||||
|         (25, _("storage path is")), | ||||
|     ] | ||||
| 
 | ||||
|     saved_view = models.ForeignKey( | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user