No. It also did not work. It was also giving similar error.

On Saturday, December 6, 2014, Collin Anderson <cmawebs...@gmail.com> wrote:

> Hi,
>
> Does this work? (What you've already tried, but not using autoslug at all.)
>
> from django.utils.text import slugify
>
>     slug = models.SlugField(null=True, blank=True)
>     def save(self, *args, **kwargs):
>         self.slug = slugify(self.name or '')
>         super(Shop, self).save(*args, **kwargs)
>
> If you have a "pretty" django traceback, you can click to expand where it
> says "▶ Local vars".
>
> Collin
>
>
> On Friday, December 5, 2014 8:55:06 AM UTC-5, Danish Ali wrote:
>>
>> If I remove slug code, then everything works fine.
>> And can you tell me how can I expand the variables?
>>
>> Thanks
>>
>> On Fri, Dec 5, 2014 at 6:51 PM, Collin Anderson <cmawe...@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> If you remove all the slug code do you still get this error? If so, then
>>> the error has nothing to do with automatically creating a slug.
>>>
>>> Try expanding Local vars to see what "params" and "sql are.
>>> File "e:\python\lib\site-packages\django\db\models\sql\compiler.py" in
>>> execute_sql
>>>   920.                 cursor.execute(sql, params)
>>> File "e:\python\lib\site-packages\django\db\backends\utils.py" in
>>> execute
>>>   85.             sql = self.db.ops.last_executed_query(self.cursor, sql
>>> , params)
>>>
>>> This does seem like a bug in mysql-connector. You may want to bring it
>>> up on the mysql-connector list. http://forums.mysql.com/list.php?50
>>>
>>> You could also try using mysqlclient instead to see if you still have
>>> the problem. That's django's recommended connector.
>>> https://pypi.python.org/pypi/mysqlclient
>>> https://docs.djangoproject.com/en/dev/ref/databases/#
>>> mysql-db-api-drivers
>>>
>>> Collin
>>>
>>> On Wednesday, December 3, 2014 3:33:48 PM UTC-5, Danish Ali wrote:
>>>>
>>>> so is there anyway to create slug automatically other than this ?
>>>>
>>>> On Thu, Dec 4, 2014 at 1:29 AM, donarb <don...@nwlink.com> wrote:
>>>>
>>>>> On Wednesday, December 3, 2014 11:59:42 AM UTC-8, Danish Ali wrote:
>>>>>>
>>>>>> this is stacktrace when I use: slug = AutoSlugField(populate_from='name')
>>>>>> in my model
>>>>>>
>>>>>>
>>>>>> Environment:
>>>>>>
>>>>>>
>>>>>> Request Method: POST
>>>>>> Request URL: http://127.0.0.1:8000/admin/product/shop/add/
>>>>>>
>>>>>> Django Version: 1.7.1
>>>>>> Python Version: 3.4.2
>>>>>> Installed Applications:
>>>>>> ('django.contrib.admin',
>>>>>>  'django.contrib.auth',
>>>>>>  'django.contrib.contenttypes',
>>>>>>  'django.contrib.sessions',
>>>>>>  'django.contrib.messages',
>>>>>>  'django.contrib.staticfiles',
>>>>>>  'product')
>>>>>> Installed Middleware:
>>>>>> ('django.contrib.sessions.middleware.SessionMiddleware',
>>>>>>  'django.middleware.common.CommonMiddleware',
>>>>>>  'django.middleware.csrf.CsrfViewMiddleware',
>>>>>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>>>>>  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>>>>>>  'django.contrib.messages.middleware.MessageMiddleware',
>>>>>>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>>>>>>
>>>>>>
>>>>>> Traceback:
>>>>>> File "e:\python\lib\site-packages\django\core\handlers\base.py" in
>>>>>> get_response
>>>>>>   111.                     response = wrapped_callback(request,
>>>>>> *callback_args, **callback_kwargs)
>>>>>> File "e:\python\lib\site-packages\django\contrib\admin\options.py"
>>>>>> in wrapper
>>>>>>   584.                 return self.admin_site.admin_view(view)(*args,
>>>>>> **kwargs)
>>>>>> File "e:\python\lib\site-packages\django\utils\decorators.py" in
>>>>>> _wrapped_view
>>>>>>   105.                     response = view_func(request, *args,
>>>>>> **kwargs)
>>>>>> File "e:\python\lib\site-packages\django\views\decorators\cache.py"
>>>>>> in _wrapped_view_func
>>>>>>   52.         response = view_func(request, *args, **kwargs)
>>>>>> File "e:\python\lib\site-packages\django\contrib\admin\sites.py" in
>>>>>> inner
>>>>>>   204.             return view(request, *args, **kwargs)
>>>>>> File "e:\python\lib\site-packages\django\contrib\admin\options.py"
>>>>>> in add_view
>>>>>>   1454.         return self.changeform_view(request, None, form_url,
>>>>>> extra_context)
>>>>>> File "e:\python\lib\site-packages\django\utils\decorators.py" in
>>>>>> _wrapper
>>>>>>   29.             return bound_func(*args, **kwargs)
>>>>>> File "e:\python\lib\site-packages\django\utils\decorators.py" in
>>>>>> _wrapped_view
>>>>>>   105.                     response = view_func(request, *args,
>>>>>> **kwargs)
>>>>>> File "e:\python\lib\site-packages\django\utils\decorators.py" in
>>>>>> bound_func
>>>>>>   25.                 return func.__get__(self, type(self))(*args2,
>>>>>> **kwargs2)
>>>>>> File "e:\python\lib\site-packages\django\db\transaction.py" in inner
>>>>>>   394.                 return func(*args, **kwargs)
>>>>>> File "e:\python\lib\site-packages\django\contrib\admin\options.py"
>>>>>> in changeform_view
>>>>>>   1405.                 self.save_model(request, new_object, form,
>>>>>> not add)
>>>>>> File "e:\python\lib\site-packages\django\contrib\admin\options.py"
>>>>>> in save_model
>>>>>>   1046.         obj.save()
>>>>>> File "e:\python\lib\site-packages\django\db\models\base.py" in save
>>>>>>   591.                        force_update=force_update,
>>>>>> update_fields=update_fields)
>>>>>> File "e:\python\lib\site-packages\django\db\models\base.py" in
>>>>>> save_base
>>>>>>   619.             updated = self._save_table(raw, cls, force_insert,
>>>>>> force_update, using, update_fields)
>>>>>> File "e:\python\lib\site-packages\django\db\models\base.py" in
>>>>>> _save_table
>>>>>>   700.             result = self._do_insert(cls._base_manager,
>>>>>> using, fields, update_pk, raw)
>>>>>> File "e:\python\lib\site-packages\django\db\models\base.py" in
>>>>>> _do_insert
>>>>>>   733.                                using=using, raw=raw)
>>>>>> File "e:\python\lib\site-packages\django\db\models\manager.py" in
>>>>>> manager_method
>>>>>>   92.                 return getattr(self.get_queryset(),
>>>>>> name)(*args, **kwargs)
>>>>>> File "e:\python\lib\site-packages\django\db\models\query.py" in
>>>>>> _insert
>>>>>>   921.         return query.get_compiler(using=using
>>>>>> ).execute_sql(return_id)
>>>>>> File "e:\python\lib\site-packages\django\db\models\sql\compiler.py"
>>>>>> in execute_sql
>>>>>>   920.                 cursor.execute(sql, params)
>>>>>> File "e:\python\lib\site-packages\django\db\backends\utils.py" in
>>>>>> execute
>>>>>>   85.             sql = self.db.ops.last_executed_query(self.cursor,
>>>>>> sql, params)
>>>>>> File "e:\python\lib\site-packages\mysql\connector\django\base.py" in
>>>>>> last_executed_query
>>>>>>   371.         return cursor.statement
>>>>>> File "e:\python\lib\site-packages\mysql\connector\django\base.py" in
>>>>>> __getattr__
>>>>>>   147.         return getattr(self.cursor, attr)
>>>>>> File "e:\python\lib\site-packages\mysql\connector\cursor.py" in
>>>>>> statement
>>>>>>   858.             return self._executed.strip()
>>>>>>
>>>>>> Exception Type: AttributeError at /admin/product/shop/add/
>>>>>> Exception Value: 'NoneType' object has no attribute 'strip'
>>>>>>
>>>>>>
>>>>> Looks like a bug in MySQL/connector (although it could just be a
>>>>> symptom of doing the same thing in Django as the bug poster):
>>>>>
>>>>> https://bugs.mysql.com/bug.php?id=74675
>>>>>
>>>>>
>>>>>  --
>>>>> You received this message because you are subscribed to a topic in the
>>>>> Google Groups "Django users" group.
>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>>>> pic/django-users/HUD95ghdbsc/unsubscribe.
>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>> django-users...@googlegroups.com.
>>>>> To post to this group, send email to django...@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/8ff7896d-a46b-4db8-8ec2-409195e7c748%40goog
>>>>> legroups.com
>>>>> <https://groups.google.com/d/msgid/django-users/8ff7896d-a46b-4db8-8ec2-409195e7c748%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Danish Ali
>>>>
>>>  --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>> topic/django-users/HUD95ghdbsc/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> django-users...@googlegroups.com.
>>> To post to this group, send email to django...@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/5cabd8b1-a4df-469e-9b74-c300593a1235%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/5cabd8b1-a4df-469e-9b74-c300593a1235%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Regards,
>> Danish Ali
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/HUD95ghdbsc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','django-users%2bunsubscr...@googlegroups.com');>
> .
> To post to this group, send email to django-users@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','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/df128920-673e-4134-a682-eeabbd6d2252%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/df128920-673e-4134-a682-eeabbd6d2252%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Regards,
Danish Ali

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B6SYO1FTyn56e380S2vSpyt6TuTOCRb%3D3h%3D-yCV6gt6tFH%2Bbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to