Skip to content

Commit

Permalink
users: {community,commercial}_terms_accepted
Browse files Browse the repository at this point in the history
We don't use the fields anymore.
  • Loading branch information
goneri committed Sep 13, 2024
1 parent 04e87cb commit afb230d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 0 additions & 2 deletions ansible_ai_connect/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ def setUp(self):
self.create_user()

self.user.user_id = str(uuid4())
self.user.community_terms_accepted = timezone.now()
self.user.save()

group_1, _ = Group.objects.get_or_create(name="Group 1")
group_2, _ = Group.objects.get_or_create(name="Group 2")
Expand Down
14 changes: 0 additions & 14 deletions ansible_ai_connect/users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from django.contrib import admin
from django.contrib.auth.admin import GroupAdmin, UserAdmin
from django.contrib.auth.models import Group
from import_export import resources
from import_export.admin import ExportMixin

from .models import User
Expand All @@ -28,27 +27,14 @@ class MembershipInline(admin.TabularInline):
extra = 0


class UserTermsResource(resources.ModelResource):
class Meta:
model = User
fields = ["username", "community_terms_accepted", "commercial_terms_accepted"]
name = "Export only user terms"


@admin.register(User)
class WisdomUserAdmin(ExportMixin, UserAdmin):
resource_classes = [UserTermsResource]
# add any additional fields you want to display in the User page
list_display = (
"username",
"is_staff",
"community_terms_accepted",
"commercial_terms_accepted",
"uuid",
)
fieldsets = UserAdmin.fieldsets + (
(None, {"fields": ("community_terms_accepted", "commercial_terms_accepted")}),
)
search_fields = UserAdmin.search_fields + ("uuid",)


Expand Down
3 changes: 0 additions & 3 deletions ansible_ai_connect/users/management/commands/createtoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,10 @@ def handle(
if u is None:
if create_user:
self.stdout.write(f"Creating a new user {username}")
n = now()
u = User.objects.create_user(
username=username,
password=password,
external_username=username,
community_terms_accepted=n,
commercial_terms_accepted=n,
)
if organization_id:
u.organization = Organization.objects.get_or_create(id=organization_id)[0]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 4.2.16 on 2024-09-13 21:05

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("users", "0013_user_email_verified_user_family_name_user_given_name_and_more"),
]

operations = [
migrations.RemoveField(
model_name="user",
name="commercial_terms_accepted",
),
migrations.RemoveField(
model_name="user",
name="community_terms_accepted",
),
]
2 changes: 0 additions & 2 deletions ansible_ai_connect/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ class Plan(models.Model):

class User(ExportModelOperationsMixin("user"), AbstractUser):
uuid = models.UUIDField(unique=True, default=uuid.uuid4, editable=False)
community_terms_accepted = models.DateTimeField(default=None, null=True)
commercial_terms_accepted = models.DateTimeField(default=None, null=True)
organization_id = deprecate_field(models.IntegerField(default=None, null=True))
organization = NonClashingForeignKey(
Organization,
Expand Down

0 comments on commit afb230d

Please sign in to comment.