Re: not a valid UUID.

2020-05-04 Thread Nomeh Uchenna Gabriel
[CONTINUED] 
I just saw "unique=true" on that field

... you may not face the problems of using "random" just yet but must face it 
at some "random time in the future" - once you see something like this:

   >>>: IntegrityError

... then shall you remember my reply.

The best option is to use a well guided function - I could even help you with 
that if you don't know much about it on my leisure. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a55e8d2f-1511-4678-9c9a-1b40a93a8025%40googlegroups.com.


Re: not a valid UUID.

2020-05-04 Thread Nomeh Uchenna Gabriel
That looks good to you but is definitely a dangerous approach if the "12 
digits" should be unique for each QuerySet since "random.random" can return 
dublicate numbers when called multiple times.

... I suggest you make a function for that or novicely adds the item's 'pk' to 
the random number making sure that it's still not more than 12 digits

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/71c45bae-8cb2-433d-ae27-2d4275c7182c%40googlegroups.com.


Re: not a valid UUID.

2020-05-03 Thread Motaz Hejaze
Great

On Sun, 3 May 2020, 4:49 pm Benedict Uwazie,  wrote:

> Thanks for your response I just found out u can't shorten UUID but I
> needed 12 digits
> what I now did was to import  the code below
> from random import randint
> my_rand = randint(1000, )
> transaction_id = models.CharField(max_length=30, unique=True, null=True,
> blank=True, editable=False, default=my_rand)
>
> Thanks
> On Sunday, 3 May 2020 11:35:30 UTC+1, Nomeh Uchenna Gabriel wrote:
>>
>> On Sunday, May 3, 2020 at 9:10:28 AM UTC+1, Benedict Uwazie wrote:
>> > Still facing the same issue
>> >
>> > On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze  wrote:
>> > default=cast_trans
>> > cast_trans = int(pass_trans)
>> >
>> > UUID is string not int
>> >
>> >
>> > On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie 
>> wrote:
>> >
>> >
>> >
>> > On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie  wrote:
>> >
>> > I added a field called transaction_id in my models.py I want that field
>> to be used to track every transaction on my "DuesLevy" model I
>> imported uuid to this to happen, but each time I migrate I get this error.
>> > How do i prevent this error from occurring each time I migrate (python
>> manage.py migrate) File
>> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>> line 2344, in to_python
>> > params={'value': value},
>> > django.core.exceptions.ValidationError: ["'13615773708697' is not a
>> valid UUID."]
>> >
>> >
>> > my models.py
>> >
>> >
>> > trans_id = uuid.uuid4()
>> > trans_str = trans_id.int
>> > pass_trans = str(trans_str)[:12]
>> > cast_trans = int(pass_trans)
>> > class DuesLevy(models.Model):
>> >
>> class_of_dues = models.CharField(max_length=30, default=options.CHOOSE, 
>> choices=options.CLASS_OF_DUES, blank=True)
>>
>> >
>> payment_circle = models.CharField(max_length=30, default=options.CHOOSE, 
>> choices=options.PAYMENT_CIRCLE)
>>
>> >
>> payment_option = models.CharField(max_length=30, default=options.CHOOSE, 
>> choices=options.PAYMENT_OPTION)
>>
>> > amount = models.DecimalField(max_digits=8, decimal_places=2)
>> >
>> transaction_id = models.UUIDField(max_length=100, unique=True, 
>> null=True, blank=True, editable=False, default=cast_trans)
>>
>> >
>> payment_channel = models.CharField(max_length=30, 
>> default=options.CHOOSE, choices=options.PAYMENT_CHANNEL_TYPE)
>>
>> > payment_date = models.DateField()
>> > date_recorded = models.DateTimeField(auto_now_add=True)
>> >
>> user = models.ForeignKey(settings.AUTH_USER_MODEL, 
>> on_delete=models.CASCADE)
>>
>> > description = models.TextField(blank=True, null=True)
>> >
>> > def __str__(self):
>> > return self.amount
>> >
>> >
>> > def get_absolute_url(self):
>> > return reverse('backend:detail_dues', kwargs={'pk': self.id})
>> >
>> >
>> >
>> >
>> >
>> >
>> > --
>> >
>> > You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> >
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to django...@googlegroups.com.
>> >
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/4a1d77cc-d1b8-4bd4-84cd-cd78e6d2eb76%40googlegroups.com.
>>
>>
>>
>>
>> On Sunday, May 3, 2020 at 9:10:28 AM UTC+1, Benedict Uwazie wrote:
>> > Still facing the same issue
>> >
>> > On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze  wrote:
>> > default=cast_trans
>> > cast_trans = int(pass_trans)
>> >
>> > UUID is string not int
>> >
>> >
>> > On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie 
>> wrote:
>> >
>> >
>> >
>> > On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie  wrote:
>> >
>> > I added a field called transaction_id in my models.py I want that field
>> to be used to track every transaction on my "DuesLevy" model I
>> imported uuid to this to happen, but each time I migrate I get this error.
>> > How do i pr

Re: not a valid UUID.

2020-05-03 Thread Benedict Uwazie
Thanks for your response I just found out u can't shorten UUID but I needed 
12 digits
what I now did was to import  the code below
from random import randint
my_rand = randint(1000, )
transaction_id = models.CharField(max_length=30, unique=True, null=True, 
blank=True, editable=False, default=my_rand)

Thanks
On Sunday, 3 May 2020 11:35:30 UTC+1, Nomeh Uchenna Gabriel wrote:
>
> On Sunday, May 3, 2020 at 9:10:28 AM UTC+1, Benedict Uwazie wrote: 
> > Still facing the same issue 
> > 
> > On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze  wrote: 
> > default=cast_trans 
> > cast_trans = int(pass_trans) 
> > 
> > UUID is string not int 
> > 
> > 
> > On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie  
> wrote: 
> > 
> > 
> > 
> > On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie  wrote: 
> > 
> > I added a field called transaction_id in my models.py I want that field 
> to be used to track every transaction on my "DuesLevy" model I 
> imported uuid to this to happen, but each time I migrate I get this error. 
> > How do i prevent this error from occurring each time I migrate (python 
> manage.py migrate) File 
> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>  
> line 2344, in to_python 
> > params={'value': value}, 
> > django.core.exceptions.ValidationError: ["'13615773708697' is not a 
> valid UUID."] 
> > 
> > 
> > my models.py 
> > 
> > 
> > trans_id = uuid.uuid4() 
> > trans_str = trans_id.int 
> > pass_trans = str(trans_str)[:12] 
> > cast_trans = int(pass_trans) 
> > class DuesLevy(models.Model): 
> > 
> class_of_dues = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.CLASS_OF_DUES, blank=True) 
>
> > 
> payment_circle = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CIRCLE) 
>
> > 
> payment_option = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_OPTION) 
>
> > amount = models.DecimalField(max_digits=8, decimal_places=2) 
> > 
> transaction_id = models.UUIDField(max_length=100, unique=True, null=True, 
> blank=True, editable=False, default=cast_trans) 
>
> > 
> payment_channel = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CHANNEL_TYPE) 
>
> > payment_date = models.DateField() 
> > date_recorded = models.DateTimeField(auto_now_add=True) 
> > 
> user = models.ForeignKey(settings.AUTH_USER_MODEL, 
> on_delete=models.CASCADE) 
>
> > description = models.TextField(blank=True, null=True) 
> > 
> > def __str__(self): 
> > return self.amount 
> >  
> >
> > def get_absolute_url(self): 
> > return reverse('backend:detail_dues', kwargs={'pk': self.id}) 
> > 
> > 
> > 
> > 
> > 
> > 
> > -- 
> > 
> > You received this message because you are subscribed to the Google 
> Groups "Django users" group. 
> > 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to django...@googlegroups.com. 
> > 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/4a1d77cc-d1b8-4bd4-84cd-cd78e6d2eb76%40googlegroups.com.
>  
>
>
>
>
> On Sunday, May 3, 2020 at 9:10:28 AM UTC+1, Benedict Uwazie wrote: 
> > Still facing the same issue 
> > 
> > On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze  wrote: 
> > default=cast_trans 
> > cast_trans = int(pass_trans) 
> > 
> > UUID is string not int 
> > 
> > 
> > On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie  
> wrote: 
> > 
> > 
> > 
> > On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie  wrote: 
> > 
> > I added a field called transaction_id in my models.py I want that field 
> to be used to track every transaction on my "DuesLevy" model I 
> imported uuid to this to happen, but each time I migrate I get this error. 
> > How do i prevent this error from occurring each time I migrate (python 
> manage.py migrate) File 
> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>  
> line 2344, in to_python 
> > params={'value': value}, 
> > django.core.exceptions.ValidationError: ["'13615773708697' is not a 
> valid UUID."] 
> > 
> > 
> > my 

Re: not a valid UUID.

2020-05-03 Thread Nomeh Uchenna Gabriel
On Sunday, May 3, 2020 at 9:10:28 AM UTC+1, Benedict Uwazie wrote:
> Still facing the same issue
> 
> On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze  wrote:
> default=cast_trans
> cast_trans = int(pass_trans)
> 
> UUID is string not int
> 
> 
> On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie  wrote:
> 
> 
> 
> On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie  wrote:
> 
> I added a field called transaction_id in my models.py I want that field to be 
> used to track every transaction on my "DuesLevy" model I imported uuid to 
> this to happen, but each time I migrate I get this error.
> How do i prevent this error from occurring each time I migrate (python 
> manage.py migrate) File 
> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>  line 2344, in to_python
> params={'value': value},
> django.core.exceptions.ValidationError: ["'13615773708697' is not a valid 
> UUID."]
> 
> 
> my models.py
> 
> 
> trans_id = uuid.uuid4()
> trans_str = trans_id.int
> pass_trans = str(trans_str)[:12]
> cast_trans = int(pass_trans)
> class DuesLevy(models.Model):
> class_of_dues = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.CLASS_OF_DUES, blank=True)
> payment_circle = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CIRCLE)
> payment_option = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_OPTION)
> amount = models.DecimalField(max_digits=8, decimal_places=2)
> transaction_id = models.UUIDField(max_length=100, unique=True, null=True, 
> blank=True, editable=False, default=cast_trans)
> payment_channel = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CHANNEL_TYPE)
> payment_date = models.DateField()
> date_recorded = models.DateTimeField(auto_now_add=True)
> user = models.ForeignKey(settings.AUTH_USER_MODEL, 
> on_delete=models.CASCADE)
> description = models.TextField(blank=True, null=True)
> 
> def __str__(self):
> return self.amount
> 
>   
> def get_absolute_url(self):
> return reverse('backend:detail_dues', kwargs={'pk': self.id})
> 
> 
> 
> 
> 
> 
> -- 
> 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django...@googlegroups.com.
> 
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/4a1d77cc-d1b8-4bd4-84cd-cd78e6d2eb76%40googlegroups.com.



On Sunday, May 3, 2020 at 9:10:28 AM UTC+1, Benedict Uwazie wrote:
> Still facing the same issue
> 
> On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze  wrote:
> default=cast_trans
> cast_trans = int(pass_trans)
> 
> UUID is string not int
> 
> 
> On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie  wrote:
> 
> 
> 
> On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie  wrote:
> 
> I added a field called transaction_id in my models.py I want that field to be 
> used to track every transaction on my "DuesLevy" model I imported uuid to 
> this to happen, but each time I migrate I get this error.
> How do i prevent this error from occurring each time I migrate (python 
> manage.py migrate) File 
> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>  line 2344, in to_python
> params={'value': value},
> django.core.exceptions.ValidationError: ["'13615773708697' is not a valid 
> UUID."]
> 
> 
> my models.py
> 
> 
> trans_id = uuid.uuid4()
> trans_str = trans_id.int
> pass_trans = str(trans_str)[:12]
> cast_trans = int(pass_trans)
> class DuesLevy(models.Model):
> class_of_dues = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.CLASS_OF_DUES, blank=True)
> payment_circle = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CIRCLE)
> payment_option = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_OPTION)
> amount = models.DecimalField(max_digits=8, decimal_places=2)
> transaction_id = models.UUIDField(max_length=100, unique=True, null=True, 
> blank=True, editable=False, default=cast_trans)
> payment_channel = models.CharField(max_length=30, default=options.CHOOSE, 
> choices=options.PAYMENT_CHANNEL_TYPE)
> payment_date = models.DateField()
> date_recorded = models.DateTimeField(auto_now_ad

Re: not a valid UUID.

2020-05-03 Thread Benedict Uwazie
Still facing the same issue

On Sunday, 3 May 2020 03:27:46 UTC+1, Motaz Hejaze wrote:
>
> default=cast_trans cast_trans = int(pass_trans)
> UUID is string not int
>
> On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie  > wrote:
>
>>
>>
>> On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie wrote:
>>>
>>> I added a field called transaction_id in my models.py I want that field 
>>> to be used to track every transaction on my "DuesLevy" model I imported 
>>> uuid 
>>> to this to happen, but each time I migrate I get this error.
>>> How do i prevent this error from occurring each time I migrate (python 
>>> manage.py migrate) File 
>>> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>>>  
>>> line 2344, in to_python
>>> params={'value': value},
>>> django.core.exceptions.ValidationError: ["'13615773708697' is not a 
>>> valid UUID."]
>>>
>>> *my models.py*
>>> trans_id = uuid.uuid4()
>>> trans_str = trans_id.int
>>> pass_trans = str(trans_str)[:12]
>>> cast_trans = int(pass_trans)
>>> class DuesLevy(models.Model):
>>> class_of_dues = models.CharField(max_length=30, default
>>> =options.CHOOSE, choices=options.CLASS_OF_DUES, blank=True)
>>> payment_circle = models.CharField(max_length=30, default
>>> =options.CHOOSE, choices=options.PAYMENT_CIRCLE)
>>> payment_option = models.CharField(max_length=30, default
>>> =options.CHOOSE, choices=options.PAYMENT_OPTION)
>>> amount = models.DecimalField(max_digits=8, decimal_places=2)
>>> transaction_id = models.UUIDField(max_length=100, unique=True, null=
>>> True, blank=True, editable=False, default=cast_trans)
>>> payment_channel = models.CharField(max_length=30, default
>>> =options.CHOOSE, choices=options.PAYMENT_CHANNEL_TYPE)
>>> payment_date = models.DateField()
>>> date_recorded = models.DateTimeField(auto_now_add=True)
>>> user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete
>>> =models.CASCADE)
>>> description = models.TextField(blank=True, null=True)
>>>
>>> def __str__(self):
>>> return self.amount
>>> 
>>>   
>>> def get_absolute_url(self):
>>> return reverse('backend:detail_dues', kwargs={'pk': self.id})
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/4a1d77cc-d1b8-4bd4-84cd-cd78e6d2eb76%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/4a1d77cc-d1b8-4bd4-84cd-cd78e6d2eb76%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56e9691b-bb0f-4d27-8f97-def14e34217d%40googlegroups.com.


Re: not a valid UUID.

2020-05-02 Thread Motaz Hejaze
default=cast_trans cast_trans = int(pass_trans)
UUID is string not int

On Sun, May 3, 2020 at 4:05 AM Benedict Uwazie  wrote:

>
>
> On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie wrote:
>>
>> I added a field called transaction_id in my models.py I want that field
>> to be used to track every transaction on my "DuesLevy" model I imported uuid
>> to this to happen, but each time I migrate I get this error.
>> How do i prevent this error from occurring each time I migrate (python
>> manage.py migrate) File
>> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>> line 2344, in to_python
>> params={'value': value},
>> django.core.exceptions.ValidationError: ["'13615773708697' is not a valid
>> UUID."]
>>
>> *my models.py*
>> trans_id = uuid.uuid4()
>> trans_str = trans_id.int
>> pass_trans = str(trans_str)[:12]
>> cast_trans = int(pass_trans)
>> class DuesLevy(models.Model):
>> class_of_dues = models.CharField(max_length=30, default
>> =options.CHOOSE, choices=options.CLASS_OF_DUES, blank=True)
>> payment_circle = models.CharField(max_length=30, default
>> =options.CHOOSE, choices=options.PAYMENT_CIRCLE)
>> payment_option = models.CharField(max_length=30, default
>> =options.CHOOSE, choices=options.PAYMENT_OPTION)
>> amount = models.DecimalField(max_digits=8, decimal_places=2)
>> transaction_id = models.UUIDField(max_length=100, unique=True, null=
>> True, blank=True, editable=False, default=cast_trans)
>> payment_channel = models.CharField(max_length=30, default
>> =options.CHOOSE, choices=options.PAYMENT_CHANNEL_TYPE)
>> payment_date = models.DateField()
>> date_recorded = models.DateTimeField(auto_now_add=True)
>> user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete
>> =models.CASCADE)
>> description = models.TextField(blank=True, null=True)
>>
>> def __str__(self):
>> return self.amount
>>
>>
>> def get_absolute_url(self):
>> return reverse('backend:detail_dues', kwargs={'pk': self.id})
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4a1d77cc-d1b8-4bd4-84cd-cd78e6d2eb76%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4a1d77cc-d1b8-4bd4-84cd-cd78e6d2eb76%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-fS__yc-mkPjTvkrNuRUarogCeuafRjss5B5ZYJxmckZQ%40mail.gmail.com.


Re: not a valid UUID.

2020-05-02 Thread Benedict Uwazie


On Sunday, 3 May 2020 01:38:16 UTC+1, Benedict Uwazie wrote:
>
> I added a field called transaction_id in my models.py I want that field 
> to be used to track every transaction on my "DuesLevy" model I imported uuid 
> to this to happen, but each time I migrate I get this error.
> How do i prevent this error from occurring each time I migrate (python 
> manage.py migrate) File 
> "C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
>  
> line 2344, in to_python
> params={'value': value},
> django.core.exceptions.ValidationError: ["'13615773708697' is not a valid 
> UUID."]
>
> *my models.py*
> trans_id = uuid.uuid4()
> trans_str = trans_id.int
> pass_trans = str(trans_str)[:12]
> cast_trans = int(pass_trans)
> class DuesLevy(models.Model):
> class_of_dues = models.CharField(max_length=30, default
> =options.CHOOSE, choices=options.CLASS_OF_DUES, blank=True)
> payment_circle = models.CharField(max_length=30, default
> =options.CHOOSE, choices=options.PAYMENT_CIRCLE)
> payment_option = models.CharField(max_length=30, default
> =options.CHOOSE, choices=options.PAYMENT_OPTION)
> amount = models.DecimalField(max_digits=8, decimal_places=2)
> transaction_id = models.UUIDField(max_length=100, unique=True, null=
> True, blank=True, editable=False, default=cast_trans)
> payment_channel = models.CharField(max_length=30, default
> =options.CHOOSE, choices=options.PAYMENT_CHANNEL_TYPE)
> payment_date = models.DateField()
> date_recorded = models.DateTimeField(auto_now_add=True)
> user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete
> =models.CASCADE)
> description = models.TextField(blank=True, null=True)
>
> def __str__(self):
> return self.amount
> 
>   
> def get_absolute_url(self):
> return reverse('backend:detail_dues', kwargs={'pk': self.id})
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4a1d77cc-d1b8-4bd4-84cd-cd78e6d2eb76%40googlegroups.com.


not a valid UUID.

2020-05-02 Thread Benedict Uwazie
I added a field called transaction_id in my models.py I want that field to 
be used to track every transaction on my "DuesLevy" model I imported uuid to 
this to happen, but each time I migrate I get this error.
How do i prevent this error from occurring each time I migrate (python 
manage.py migrate) File 
"C:\Users\Benedict\Miniconda3\envs\django3\lib\site-packages\django\db\models\fields\__init__.py",
 
line 2344, in to_python
params={'value': value},
django.core.exceptions.ValidationError: ["'13615773708697' is not a valid 
UUID."]

*my models.py*
trans_id = uuid.uuid4()
trans_str = trans_id.int
pass_trans = str(trans_str)[:12]
cast_trans = int(pass_trans)
class DuesLevy(models.Model):
class_of_dues = models.CharField(max_length=30, default=options.CHOOSE, 
choices=options.CLASS_OF_DUES, blank=True)
payment_circle = models.CharField(max_length=30, default
=options.CHOOSE, choices=options.PAYMENT_CIRCLE)
payment_option = models.CharField(max_length=30, default
=options.CHOOSE, choices=options.PAYMENT_OPTION)
amount = models.DecimalField(max_digits=8, decimal_places=2)
transaction_id = models.(max_length=100, unique=True, null=True, blank=
True, editable=False, default=cast_trans)
payment_channel = models.CharField(max_length=30, default
=options.CHOOSE, choices=options.PAYMENT_CHANNEL_TYPE)
payment_date = models.DateField()
date_recorded = models.DateTimeField(auto_now_add=True)
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete
=models.CASCADE)
description = models.TextField(blank=True, null=True)

def __str__(self):
return self.amount

  
def get_absolute_url(self):
return reverse('backend:detail_dues', kwargs={'pk': self.id})

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/aa5a912f-e1fd-483b-b13b-bc9fdd9f1352%40googlegroups.com.


['“1” is not a valid UUID.']

2019-12-23 Thread sagar ninave
hello friends,
i am creating model and including uuid field and it is working but when i 
am applying custom user model them it is getting ['“1” is not a valid 
UUID.'] this error

please help me out

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9725df4a-7ee7-4f97-828c-c1941c23ea70%40googlegroups.com.


Re: getting error '1' is not a valid UUID in django 3.0

2019-12-14 Thread Jorge Gimeno
On Sat, Dec 14, 2019 at 8:59 AM sagar ninave  wrote:

> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/05a199fc-d328-4b1e-be09-b1cb8a4a0ee1%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/05a199fc-d328-4b1e-be09-b1cb8a4a0ee1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

The exception is pretty clear here:  The string '1' is not a valid UUID
value.  Without seeing the rest of your code, it's impossible to know where
that value came from.

-Jorge

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK-ZXLo-gtdn5N_XEpSkYryzevdCyYFTT502vZTw26VW6Q%40mail.gmail.com.


getting error '1' is not a valid UUID in django 3.0

2019-12-14 Thread sagar ninave
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/05a199fc-d328-4b1e-be09-b1cb8a4a0ee1%40googlegroups.com.