On Mar 19, 6:50 pm, Malcolm Tredinnick
wrote:
> The error is telling you exactly what the problem is. You can't do the
> automatic assignment to many-to-many relations that use an intermediate
> table. The reason being that the whole point of an intermediate table is
>
I forgot to add: the full error message is:
"Cannot set values on a ManyToManyField which specifies an
intermediary model. Use SystemTicket's Manager instead."
I'm not sure how I'd use the manager in this particular case though.
On Mar 19, 5:21 pm, Delta20 <digital_illumin
I'm getting the error "Cannot set values on a ManyToManyField which
specifies an intermediary model." when I try to call form.save_m2m()
and I would appreciate any tips as to how to work around this.
Here's some code that illustrates what I am doing:
---
# Using a basic form in a view function:
Thanks Malcolm.
For anyone interested in this topic, I have created a snippet with my
solution:
http://www.djangosnippets.org/snippets/1301/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To
Is there a way to make it so that when you create a User in admin, the
password is set such that the user cannot login using ModelBackend?
I'm using two authentication backends, a custom backend and
Modelbackend: i.e.:
AUTHENTICATION_BACKENDS = ('myapp.auth.ActiveDirectoryBackend',
Fixtures are geared towards unit testing; I'm wondering if they are
considered a good way to populate the database with some initial
default values.
For example, say we have a model TicketState, and the applications
must be guaranteed to have two TicketStates representing the states
"Open" and
Anybody have any ideas?
The validators approach I mentioned can't work because UserProfile is
not a field of UserChangeForm. Is there a way I can add a validation
requirement to UserAdmin (i.e. the ModelAdmin)?
--~--~-~--~~~---~--~~
You received this message
I have a UserProfile admin form inline with the admin form for Users,
and I was wondering if there is a simple way to enforce a requirement
to have a UserProfile.
It looks like I need to create a custom form to use in a custom
UserAdmin (ModelAdmin) class for User, so I can add the appropriate
Natural sort order is a pretty common requirement - Windows Explorer
and the Mac Finder are both examples of natural sort in action. It's
true there are lots of edge cases, but just handling letters and
digits in a human-reabable way is enough in many cases.
It seems the solution is to add a
Is there a way to make a model manager get_query_set function return
items sorted in natural alphanumeric order? order_by returns things in
rather than the ASCII order, which is not generally what users expect.
For example, sorting by name for a set of objects with names: img10,
img1, img103,
In case anyone else is looking for a solution to this, here's the work-
around I came up with:
In the ModelAdmin class for Ticket, override the save_model function
and force the m2m relations to be saved. For example:
class TicketAdmin(admin.ModelAdmin):
model = Ticket
def
I'm trying to generate a slug for a model, based on the contents of
many2many field, but my approaches so far don't seem to work. I'd be
grateful if anyone point me towards a better approach. Here's a simple
example of what I'm doing:
class Item(models.Model):
name = models.CharField()
NetBeans for Python has been released and based on the NB Python
roadmap, it looks interesting for those of us working with Django. I
haven't had much of a chance to play with it yet since it just came
out today, but here's the info for anyone interested:
NetBeans IDE for Python:
A model field may have a 'choices' option to which you assign an
iterable object -- typically a list, but this can also be an iterable
function. Is there a way to assign a class method/function rather than
a module function?
Here's what I'm trying to do: I have a model, "Ticket" that can be in
I just realized that I accidentally named the template 400.html not
404.html... d'oh. I definitely need a better way of diagnosing 500
errors.
Thanks to the pointer to the email settings. I will set that up, but
I'm wondering if there's a way to direct django to log those errors
rather than
Is there a way to have django log 500 errors to a file, and otherwise
log stderr/stdout to a file somewhere?
The problem I'm having right now is that I'm getting a 500 error
instead of 404s when Debug=False. I get 404s as expected when
Debug=True. I can't for the life of me figure out what is
In case anyone else is trying to figure out how to do this, the
solution I came up with was to put a dictionary of the values into the
request and pass it to the ModelAdmin add_view function
def some_view(request, ... ):
...
values = { 'title': t, 'author': a }
# make QueryDict
I want to be able to use the standard/auto-generated admin add form,
but need to put default values in the fields. Is this possible?
Basically I want to do something like this in a view:
1: def some_view(request, ... ):
2: ...
3: values = { 'title': t, 'author': a }
4: admin =
What's the cleanest way to customize the submit buttons that appear on
an admin change_form? If there's a way to override submit_row on
change_form, that would be the simplest approach, I think, but I'm
very much a django beginner so I would appreciate some guidance.
To provide some context,
I have the exact same question. I also tried using
"object.get_content_object.get_absolute_url" but that didn't work
either.
On Sep 22, 5:25 pm, macgregor <[EMAIL PROTECTED]> wrote:
> I have the new Comments app installed and working and want to modify
>
Thanks Malcolm for giving the background for some of this comments.
Taken out of context, that talk was indeed a little bit misleading.
Even without knowing the context, I felt that most of his points are
not showstoppers for most projects. The good very comfortably
outweighs the bad, so much so
True, it is a little much to transcribe, so I'll briefly summarize his
main points for everyone else:
- Python sucks, especially significant whitespace (I agree heartily.
Only Django keeps me using Python.)
- Django could be a lot smarter about scaling the DB (sharding,
denormalization, etc)
-
Does anyone know where I can find a transcript, write-up or similar of
Cal Henderson's keynote presentation at DjangoCon? Sounds like it was
interesting stuff.
There is a youtube video here, but it's pretty long:
http://uk.youtube.com/watch?v=i6Fr65PFqfk
I want to post this tip here in case this trips up other people:
The error message " objects don't have get_absolute_url()
methods" does not necessarily mean what it says. The error message is
also displayed if there is an error in the the method.
If a model has a get_absolute_url method that
This question is aimed at those of you who, like me, come from a Java
and C++ background and are used to being able to debug things with a
debugger - setting breakpoints, stepping through code, evaluating
expressions, etc. What do you find to be the most productive approach
to debugging Django
25 matches
Mail list logo