BasicallyHereIt is the same as, but since there is no answer, I will ask you a question.
I wrote uuid as below in the model of django.
class User (models.Model): class Meta: db_table ='user' def get_uuid_no_dash (): return uuid.uuid4 (). hex # User ID id = models.CharField (primary_key = True, default = get_uuid_no_dash, max_length = 33, editable = False, unique = True) #id = models.UUIDField (primary_key = True, default = uuid.uuid4, editable = False) # username user_name = models.CharField (verbose_name = "username", max_length = 20, unique = True) # Profile photo (not required) prof_image = models.ImageField (upload_to ='images', verbose_name = "profile image", null = True, blank = True) # Self-introduction (not required) intro = models.TextField (verbose_name ='introduction', null = True, blank = True) #Skill tag skills = TaggableManager (verbose_name ='skills', blank = True) def __str __ (self): return self.user_name
After that, when I migrated and tried to add data with admin, the following error occurred.
ValueError at/admin/user/user/add / Field'object_id' expected a number but got '78a0767cb607488087a73f17565bbf77'.
Probably the cause is that the letters are mixed even though only numbers are accepted, but I have little knowledge about the database and I am having trouble finding a solution. Please let me know if there is a way to avoid this error.
Answer # 1
It seems impossible with sqlite anyway, so I decided to change to mysql
Answer # 2
I thought I should use uuidField, but do I want to eliminate hyphens instead of uuid ??
- python - i want to change the ip address that the django app gets by default from remote_addr to http_x_forwarded_for in middlew
- python - i can't find some url paths after deploying django
- python - i want to resolve typeerror: expected ptr for argument'% s'in cv2countnonzero
- python - about image deletion in django
- python - object is not displayed in html in django queryset
- name error in underscore in python django
- python - how to count url clicks in django and record them in the db
- python - valueerror: field'id' expected a number but got'suzukitadashi'
- python - [django] gte works with filter in queryset, but lt doesn't work and i can't get the specified range of data
- in python, adding to the csv file does not work cannot specify field names correctly
- python - i want to use asyncio with django custom commands
- python - django form i want to write a little smarter
- python - when will you start the startapp in django?
- python - the table element generated by the django template variable is output at the bottom of the page
- python - image field image output
- python - [django] read csv file from url
- python - i get an argument must be int or float error in django
- python - django how to receive multiple checkbox values
- python - django image folder reasons to create static and madia folders separately
- python : Quick recording of a large amount of data in Django database
- python : Error when opening a table through the admin panel Django
- python : How to withdraw a link to an image from database in Django
- python : Broke the type of admin in Django
- python : How not to violate the DRY principle in the presentation? Best practics
- python : Recruiling graphs through Django-Google-Charts
- Does not keep a form in Django Python
- python : How to connect fonts in Django?
- python : Django: Does ORM support SQL Operator "All" and "Any"?
- python : Performance Conditions when you click on the button in Django