Skip to content

Commit

Permalink
Add Citation to admin.
Browse files Browse the repository at this point in the history
linting

update migration numbers

update poetry.lock
  • Loading branch information
brunns authored and rachaelcodes committed Jun 26, 2024
1 parent 8eac17f commit d4f6b5b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions django_app/redbox_app/redbox_core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,18 @@ def export_as_csv(self, request, queryset): # noqa:ARG002
actions = ["export_as_csv"]


class CitationAdmin(admin.ModelAdmin):
list_display = ["chat_message", "text", "get_user", "file"]
list_filter = ["chat_message__chat_history__users"]

@admin.display(ordering="chat_message__chat_history__users", description="User")
def get_user(self, obj):
return obj.chat_message.chat_history.users


admin.site.register(models.User, UserAdmin)
admin.site.register(models.File, FileAdmin)
admin.site.register(models.ChatHistory, ChatHistoryAdmin)
admin.site.register(models.ChatMessage, ChatMessageAdmin)
admin.site.register(models.Citation, CitationAdmin)
admin.site.register(models.BusinessUnit, BusinessUnitAdmin)
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def file_to_text_chunk(apps, schema_editor):

class Migration(migrations.Migration):
dependencies = [
("redbox_core", "0018_chatmessage_route"),
("redbox_core", "0019_alter_chatmessage_route"),
]

operations = [
Expand Down
2 changes: 1 addition & 1 deletion django_app/tests/test_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_0019_remove_chatmessage_source_files_textchunk_and_more(migrator):

assert chat_message.source_files.first().pk == file.pk
new_state = migrator.apply_tested_migration(
("redbox_core", "0019_remove_chatmessage_source_files_textchunk_and_more"),
("redbox_core", "0020_remove_chatmessage_source_files_textchunk_and_more"),
)
NewChatMessage = new_state.apps.get_model("redbox_core", "ChatMessage") # noqa: N806
Citation = new_state.apps.get_model("redbox_core", "Citation")
Expand Down

0 comments on commit d4f6b5b

Please sign in to comment.