Re: Field forced to not-null

2018-08-09 Thread Phlip Pretorius
Thank you Andréas and Jason

That solved my problem

Regards,

Phlip

On Monday, August 6, 2018 at 3:02:01 PM UTC+2, Andréas Kühne wrote:
>
> Hi Philip,
>
> The field is required because you haven't allowed it to be blank - and 
> django admin requires fields to have the following attributes if you don't 
> require them:
> Active = models.CharField(max_length=1, null=True, blank=True)
>
> Otherwise the GUI will mark the field as required.
> See here: https://docs.djangoproject.com/en/2.1/ref/models/fields/#blank
>
> Regards,
>
> Andréas
>
> 2018-08-06 12:54 GMT+02:00 Phlip Pretorius 
> >:
>
>> Hallo,
>>
>> I have created a model that looks like this:
>>
>> 
>> class ActionType(models.Model):
>> """The type of actions that must be taken at a meeting with respect to
>> agenda points e.g. 'Decide', 'Take Note'etc.
>> """
>> AtpCode = models.CharField(max_length=4)
>> AtpDesc = models.CharField(max_length=80, null=False)
>> Active = models.CharField(max_length=1, null=True)
>>
>> class Meta:
>> unique_together = (('AtpCode'),)
>>
>> def __str__(self):
>> """Return a string representation of the model"""
>> return self.AtpCode
>> 
>>
>> I am using SQLite as I am developing.
>>
>> When I deploy this model to SQLite, the Active field is forced to be 
>> non-null although explicitly indicate the null=True.
>>
>> Any idea why this is happening? I have deleted the complete Django 
>> project and started from scratch only to find the same scenario; when I 
>> click save, I get the following message.
>>
>>
>> Any advice will be welcomed.
>>
>> Regards,
>>
>> Phlip
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/c897956a-d5c1-42d6-a77c-ec8c46670815%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d365045e-2f42-4889-880a-840950d6e01c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Field forced to not-null

2018-08-06 Thread Jason
A good thing to keep in mind is null is for the database, and blank is for 
django validation

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1e0ec779-7372-412c-adcb-104035f40c8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Field forced to not-null

2018-08-06 Thread Andréas Kühne
Hi Philip,

The field is required because you haven't allowed it to be blank - and
django admin requires fields to have the following attributes if you don't
require them:
Active = models.CharField(max_length=1, null=True, blank=True)

Otherwise the GUI will mark the field as required.
See here: https://docs.djangoproject.com/en/2.1/ref/models/fields/#blank

Regards,

Andréas

2018-08-06 12:54 GMT+02:00 Phlip Pretorius :

> Hallo,
>
> I have created a model that looks like this:
>
> 
> class ActionType(models.Model):
> """The type of actions that must be taken at a meeting with respect to
> agenda points e.g. 'Decide', 'Take Note'etc.
> """
> AtpCode = models.CharField(max_length=4)
> AtpDesc = models.CharField(max_length=80, null=False)
> Active = models.CharField(max_length=1, null=True)
>
> class Meta:
> unique_together = (('AtpCode'),)
>
> def __str__(self):
> """Return a string representation of the model"""
> return self.AtpCode
> 
>
> I am using SQLite as I am developing.
>
> When I deploy this model to SQLite, the Active field is forced to be
> non-null although explicitly indicate the null=True.
>
> Any idea why this is happening? I have deleted the complete Django project
> and started from scratch only to find the same scenario; when I click save,
> I get the following message.
>
>
> Any advice will be welcomed.
>
> Regards,
>
> Phlip
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/c897956a-d5c1-42d6-a77c-ec8c46670815%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCcmuDkJQdnYsGnop01Q8waXr6cW3eRGxrokYH-irj0s5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Field forced to not-null

2018-08-06 Thread Phlip Pretorius
Hallo,

I have created a model that looks like this:


class ActionType(models.Model):
"""The type of actions that must be taken at a meeting with respect to
agenda points e.g. 'Decide', 'Take Note'etc.
"""
AtpCode = models.CharField(max_length=4)
AtpDesc = models.CharField(max_length=80, null=False)
Active = models.CharField(max_length=1, null=True)

class Meta:
unique_together = (('AtpCode'),)

def __str__(self):
"""Return a string representation of the model"""
return self.AtpCode


I am using SQLite as I am developing.

When I deploy this model to SQLite, the Active field is forced to be 
non-null although explicitly indicate the null=True.

Any idea why this is happening? I have deleted the complete Django project 
and started from scratch only to find the same scenario; when I click save, 
I get the following message.


Any advice will be welcomed.

Regards,

Phlip

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c897956a-d5c1-42d6-a77c-ec8c46670815%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.