Monday, December 1, 2014

Re: Error: 'NoneType' object has no attribute 'strip'

Have you tried following the stacktrace that resulted in the error? 

Does it fail when trying to strip the contents of the "name" field?

On Mon, Dec 1, 2014 at 10:16 AM, Danish Ali <danish@jotixtech.com> wrote:
I am using admin to enter data.
This is the URL from where I am trying to save records: http://127.0.0.1:8000/admin/product/shop/add/


On Monday, December 1, 2014 6:15:08 PM UTC+5, Jani Tiainen wrote:
On Mon, 1 Dec 2014 04:12:45 -0800 (PST)
Danish Ali <dan...@jotixtech.com> wrote:

> Hello,
>
> I am getting this error: Error: 'NoneType' object has no attribute 'strip'
> I have created a model and I am trying to autofill slug field in it. When I
> save the record in database I get this error: Error: 'NoneType' object has
> no attribute 'strip'
>
> My model is:
>
> from django.db import models
> from autoslug import AutoSlugField
>
> # Create your models here.
>
> class Shop(models.Model):
>     name = models.CharField(max_length=200)
>     image = models.CharField(max_length=200)
>     description = models.TextField()
>     slug = models.SlugField(null=True, blank=True)
>     slug = AutoSlugField(populate_from='name')
>
>
> If I remove: slug = AutoSlugField(populate_from='name') then it works fine.
> So, can someone tell me what is the issue here?

How are you trying to set data and trying to save to database (used commands would be helpful)

--

Jani Tiainen

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b6a557f5-5a11-4f02-bc22-2823a49b9495%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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALn3ei28WYSWj9_LB33jWLyzS%3DqqPhkLtB83jGmMVkQUQm0R%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Error: 'NoneType' object has no attribute 'strip'

I am using admin to enter data.
This is the URL from where I am trying to save records: http://127.0.0.1:8000/admin/product/shop/add/


On Monday, December 1, 2014 6:15:08 PM UTC+5, Jani Tiainen wrote:
On Mon, 1 Dec 2014 04:12:45 -0800 (PST)
Danish Ali <dan...@jotixtech.com> wrote:

> Hello,
>
> I am getting this error: Error: 'NoneType' object has no attribute 'strip'
> I have created a model and I am trying to autofill slug field in it. When I
> save the record in database I get this error: Error: 'NoneType' object has
> no attribute 'strip'
>
> My model is:
>
> from django.db import models
> from autoslug import AutoSlugField
>
> # Create your models here.
>
> class Shop(models.Model):
>     name = models.CharField(max_length=200)
>     image = models.CharField(max_length=200)
>     description = models.TextField()
>     slug = models.SlugField(null=True, blank=True)
>     slug = AutoSlugField(populate_from='name')
>
>
> If I remove: slug = AutoSlugField(populate_from='name') then it works fine.
> So, can someone tell me what is the issue here?

How are you trying to set data and trying to save to database (used commands would be helpful)

--

Jani Tiainen

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b6a557f5-5a11-4f02-bc22-2823a49b9495%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Error: 'NoneType' object has no attribute 'strip'

On Mon, 1 Dec 2014 04:12:45 -0800 (PST)
Danish Ali <danish@jotixtech.com> wrote:

> Hello,
>
> I am getting this error: Error: 'NoneType' object has no attribute 'strip'
> I have created a model and I am trying to autofill slug field in it. When I
> save the record in database I get this error: Error: 'NoneType' object has
> no attribute 'strip'
>
> My model is:
>
> from django.db import models
> from autoslug import AutoSlugField
>
> # Create your models here.
>
> class Shop(models.Model):
> name = models.CharField(max_length=200)
> image = models.CharField(max_length=200)
> description = models.TextField()
> slug = models.SlugField(null=True, blank=True)
> slug = AutoSlugField(populate_from='name')
>
>
> If I remove: slug = AutoSlugField(populate_from='name') then it works fine.
> So, can someone tell me what is the issue here?

How are you trying to set data and trying to save to database (used commands would be helpful)

--

Jani Tiainen

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20141201151426.2fdd643f%40jns42-l.w2k.keypro.fi.
For more options, visit https://groups.google.com/d/optout.

Re: Error: 'NoneType' object has no attribute 'strip'

still same error.

On Monday, December 1, 2014 5:36:52 PM UTC+5, WongoBongo wrote:
Comment out the earlier slug field. What happens?

# slug = models.SlugField(null=True, blank=True)

K

On Monday, December 1, 2014 4:12:45 AM UTC-8, Danish Ali wrote:
Hello,

I am getting this error: Error: 'NoneType' object has no attribute 'strip'
I have created a model and I am trying to autofill slug field in it. When I save the record in database I get this error: Error: 'NoneType' object has no attribute 'strip'

My model is:

from django.db import models
from autoslug import AutoSlugField

# Create your models here.

class Shop(models.Model):
    name = models.CharField(max_length=200)
    image = models.CharField(max_length=200)
    description = models.TextField()
    slug = models.SlugField(null=True, blank=True)
    slug = AutoSlugField(populate_from='name')


If I remove: slug = AutoSlugField(populate_from='name') then it works fine. So, can someone tell me what is the issue here?

Thanks 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3e9fd72f-0f84-4015-aa5c-6606b95bc387%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Error: 'NoneType' object has no attribute 'strip'

Comment out the earlier slug field. What happens?

# slug = models.SlugField(null=True, blank=True)

K

On Monday, December 1, 2014 4:12:45 AM UTC-8, Danish Ali wrote:
Hello,

I am getting this error: Error: 'NoneType' object has no attribute 'strip'
I have created a model and I am trying to autofill slug field in it. When I save the record in database I get this error: Error: 'NoneType' object has no attribute 'strip'

My model is:

from django.db import models
from autoslug import AutoSlugField

# Create your models here.

class Shop(models.Model):
    name = models.CharField(max_length=200)
    image = models.CharField(max_length=200)
    description = models.TextField()
    slug = models.SlugField(null=True, blank=True)
    slug = AutoSlugField(populate_from='name')


If I remove: slug = AutoSlugField(populate_from='name') then it works fine. So, can someone tell me what is the issue here?

Thanks 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/16970138-6267-4711-bbc4-feb6371d2c43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Error: 'NoneType' object has no attribute 'strip'

Hello,

I am getting this error: Error: 'NoneType' object has no attribute 'strip'
I have created a model and I am trying to autofill slug field in it. When I save the record in database I get this error: Error: 'NoneType' object has no attribute 'strip'

My model is:

from django.db import models
from autoslug import AutoSlugField

# Create your models here.

class Shop(models.Model):
    name = models.CharField(max_length=200)
    image = models.CharField(max_length=200)
    description = models.TextField()
    slug = models.SlugField(null=True, blank=True)
    slug = AutoSlugField(populate_from='name')


If I remove: slug = AutoSlugField(populate_from='name') then it works fine. So, can someone tell me what is the issue here?

Thanks 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b1e478e2-30df-490a-ac42-a4a669f26eab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Constructing query

Thank you Collin !
It works :)

On Sunday, November 30, 2014 9:09:46 PM UTC+2, Collin Anderson wrote:
Hi,

This might work:

Tag.objects.filter(name__startswith='A').exclude(company=None).order_by('name').all()

Collin


On Friday, November 28, 2014 9:08:42 AM UTC-5, termopro wrote:
I have 2 models:
Companies and Tags.

A company may have several tags associated with it, so Tag contains many-to-many relation to Company.

If i'd like to get Tags starting with "A" i'd write:
tags = Tag.objects.filter(name__startswith='A').order_by('name').all()

But how do i get the list of tags (beginning with letter 'A') which are associated with at least 1 company ?

In sql it would be something like:

SELECT * FROM
tag
WHERE
name LIKE 'A%' AND id IN (SELECT tag_id FROM tag_organization)


?

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c9beb30d-33f5-453a-ae79-dc5100801eea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.