Wooof, thanks for reply. Well, look. I had a "news/models.py" file
with definitions of Source (type of news) and Element(the news
elements theirselves) with a foreign key "Source".

The script I used to gather news from different sites looks like this:
---
title = "title"
date=datetime.now())
new_element = Element(title=title, date=date, source=source_object)
new_element.save()
---

Element's "get_absolute_url" returned "/news/2009/jan/12/7788/"
according to PK, wich is 7788 here. Then, I decided to make slugs for
news elements so that it returned some "useful" urls.

I added "slug = models.SlugField(max_length=200)" to the model and
added char field "slug" to mysql database. Then, changed the script
adding a slug field either to manual or "slugifying it" from title -
nothing worked:
---
title = "title"
date=datetime.now())
slug = "test-slug" #or slugify(title)
new_element = Element(title=title, date=date, source=source_object,
slug=slug)
new_element.save()
---

It keeps falling with that TypeError above. And... it throws
"_mysql_exceptions.Warning: Field 'slug' doesn't have a default value"
- fixing that from model or base doesn't help either.

But... the code works from the shell fine.

That's all.

On Dec 12, 12:58 am, Shawn Milochik <sh...@milochik.com> wrote:
> On Dec 11, 2009, at 4:51 PM, tezro wrote:
>
>
>
> > Seems like no clues...
>
> > On Dec 10, 12:21 am, bruno desthuilliers
> > <bruno.desthuilli...@gmail.com> wrote:
> >> On 9 déc, 18:58, tezro <tezro...@gmail.com> wrote:
> >> (snip)
>
> >>> That throws an error: TypeError: 'slug' is an invalid keyword argument
> >>> for this function.
>
> >>> What am I doing wrong?
>
> >> Not posting the full traceback - tracebacks are here to help debugging
> >> a problem, not to fill your term with random gibberish !-)
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> Tezro,
>
> What Bruno meant is that, unless you post *all* of the text that printed out 
> around the error message (not just that one line), you have not provided 
> enough information for us to help you.
>
> Anyone on this list can probably tell you exactly what that TypeError means. 
> But telling you that won't solve your problem.
>
> This error:  
>
> >>> TypeError: 'slug' is an invalid keyword argument
>
> means that somewhere in your Python code, the keyword argument slug = "some 
> value" is being passed to a function. That function doesn't know what to do 
> with a 'slug' keyword, because that function's definition doesn't accept it, 
> nor does it have a **kwargs portion.
>
> So, although I've told you what the problem is, I haven't helped you much 
> with your question "what am I doing wrong." But if you provide more of the 
> information about the error, and preferably the section of code that is 
> generating it, you will get help that is much more useful to solving the 
> problem.
>
> Shawn

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to