Hi,
See this ticket for details on the error you are seeing:
http://south.aeracode.org/ticket/407
If I understand correctly, it sounds like you're asking for something
that isn't possible anyway.
The id isn't known until the item is inserted into the database,
because the database assigns the
You should definitely be using a POST request - an important aspect of
the design of any web application is that get requests should not
change server side state, for this exact reason.
http://stackoverflow.com/questions/46585/when-do-you-use-post-and-when-do-you-use-get
--
You received this
I realised the second question is answered here:
http://docs.webfaction.com/software/django/troubleshooting.html#accessing-remote-addr
which is a middleware that was removed a while back.
The first bit of my question still stands though!
--
You received this message because you are subscribed
By default many to many fields on self are symmetric[1], yours can't
be (if A is up from B, B isn't up from A), so you need to specify
symmetrical=False. You'll also need to specify some related names
because they will clash.
You might want to rethink your model though anyway, I'm not convinced
On Dec 1, 2:43 am, Andre Terra wrote:
> Noob question here: why would it need limit=5 if the funcion has default
> values?
Even if it has a default value, you still need to call it to get your
decorator. As someone wrote above, its a function that returns a
decorator, not
On the unlikely chance that anyone turns up with the same problem for
google, I'll post my solution. Still would love to know what the
original problem was.
from django.utils.importlib import import_module
session_engine = import_module(settings.SESSION_ENGINE)
session =
Hi all,
I've recently updated to svn trunk and I think the new HMAC changes
are causing me an issue.
I have a custom admin view that handles uploads from the YUI flash
uploader. Unfortunately the flash applet doesn't send cookies with it,
so in order to check authentication in the page
It can't be done like that.
Look at any website and you'll see that never is the picture somehow
"embedded" in the page, it's linked by an img tag that points at the
url of the image.
What he was saying is that you need two separate views. In the first,
return your page with an img tag pointing
Thanks for the help guys. I started trying to log things, and only
then did I notice that I'd missed the obvious - one of the few queries
was taking 11s!
Turns out it was a pointless join from a weird use of queries (a
queryset contructed one place with more filters added elsewhere in an
odd
On Mar 31, 9:42 pm, Asim Yuksel wrote:
> The people and publication are not related so I cant use manytomany
Can you post the schema of this "bridge" table you keep talking about?
Because it sounds _exactly_ like a ManyToMany
Peter
--
You received this message because
On Mar 30, 2:10 pm, Thomas wrote:
> I already found a solution by myself:
>
> doing this into the forms.py inside the class does the trick:
>
> def __init__(self, *args, **kwargs):
> super(FilterForm, self) .__init__(*args, **kwargs)
>
This is quite old but still relevant:
http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/
Basically, create your form and edit the widget with an __init__ like
this:
class FlightForm(forms.ModelForm):
def __init__(self, profile, *args, **kwargs):
super(FlightForm,
On Mar 29, 4:17 pm, Asim Yuksel wrote:
> I am entering them on the same page otherwise I will have to note down
> the ids of people and publications table and then go to bridge table
> and insert the ids there. So the reason I want to enter in the same
> page is I will
On Mar 29, 12:24 pm, bruno desthuilliers
<bruno.desthuilli...@gmail.com> wrote:
> On 29 mar, 09:12, Thierry Chich <thierry.ch...@gmail.com> wrote:
>
> > Le lundi 29 mars 2010 02:14:34, pjrhar...@gmail.com a écrit :> > OK. I can
> > also put an hidden fi
> I cant use inlines option ind admin,py because the
> tables should be related.
If they aren't related why would you want to be entering them on the
same page?
When you come to edit them again what two instances should be loaded
together if they are completely unrelated?
Given what you first
> OK. I can also put an hidden field in my form. I will evaluate what is the
> better option for me.
Bear in mind if you exclude it from your form altogether there is
nothing to stop a malicious user setting it by modifying the post
data.
Peter
--
You received this message because you are
Ideally, I want to do:
>
> {% if not ajax %}
> {% extends 'base.html' %}
> {% endif %}
> {% block content %}Content Here.{% endblock %}
Extends can't be optional. Consider the following:
base_template.html:
Foo
{% block foo %}{% endblock %}
Bar
{% block bar %}{% endblock %}
See this snippet:
http://www.djangosnippets.org/snippets/1295/
Peter
On Mar 27, 6:02 am, jwils2...@gmail.com wrote:
> I believe the answer is to append a regular Form to the ModelForm) with a
> single ModelMultipleChoice field and use its queryset member to manage the
> selected volunteers
On Mar 17, 7:37 pm, Joakim Hove wrote:
> Summary of redirections:
>
> Form at my site --> DIBS --> simple view at my site.
>
> Any tips?
>
> Joakim
My best guess is that the user must be getting posted back to that
address when they click a button on the external
> What constitutes a 'valid' image?
> The documentation states "ImageField... Like FileField, but validates
> that the uploaded object is a valid image."
I haven't read through the code, but the error must be caught
somewhere because I just tested it out.
Trying to upload in the admin a random
On Mar 15, 10:17 pm, Henry Andersen wrote:
> Thanks for your answer, but I do need a ManyToManyField().
>
> In case anyone is curious about the answer, I solved my problem by
> overriding my custom admin form's save method. In save(), I checked for the
> existence of the file
On Mar 15, 2:38 pm, "ge...@aquarianhouse.com"
wrote:
> {% with o.id as key %}{{ dictionary.key }}{% endwith %}
>
> would be better, as in comments mentioned
It might be, if it worked. That will try and look up dictionary['key']
still.
Peter
--
You received this
You'll need a custom template tag. Something like this will probably
do:
http://push.cx/2007/django-template-tag-for-dictionary-access
Peter
On Mar 12, 7:48 pm, Rishat Muhametshin wrote:
> Hello everyone,
>
> I just can't solve a problem. I have an array of dictionaries
On Mar 12, 12:42 pm, Henry A wrote:
> Hi,
>
> For a client, I've got the following (simplified) models:
>
> class Document (models.Model):
> file = models.FileField()
>
> class Publication (models.Model):
> title = models.CharField()
> ...
> documents =
Why bother?
Cant you just do:
def reload(model):
return model.__class__.objects.get(pk=model.pk)
The call it as:
instance = reload(instance)
Peter
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
On Mar 11, 6:27 am, Praveen wrote:
> I know i can not directly register a form but i do not have any model
> for Email. i just have plain form *forms.Form*
> is there any other way to register Form with admin.
> Thanks
What would you expect it to do if you could?
On Mar 6, 2:28 am, Brian Neal wrote:
> Any ideas? Can anyone else try this and report back? Just insert the
> code below into a view function and start the dev. server with "python
> -Wall manage.py runserver". Thanks.
Hi,
Just to confirm I tried it and can't see them either,
On Mar 3, 4:52 pm, alecs wrote:
> How can I send variable from my view function(which renders my
> template) to a template tag library(which is {% load blah %} in this
> template? I want to make my tag cloud independent from model:
Your template tag has access to any
If you watch the URL as you navigate facebook with the chat open
you'll notice it doesn't actually change, just the fragment bit after
the '#' does.
I believe that the whole page minus the chat is just loaded
asynchronously, and the url fragment is changed to match so that if
you reload it it
> values = model_to_dict(instance)
> values.update(request.POST)
>
> It then fails on form.is_valid() because it's trying to match a date
> string in a date value that is actually a list with one value in it
> instead of a date string!
I can see two problems here. Firstly, the post "dictionary"
The other thing you may want to consider is whether you need to cache
the entire page or not. When users change some data, if it doesn't
change everything you could use template fragment caching, and just
delete the relevant bits when data is changed. Otherwise you could use
lower level caching in
On Jan 20, 1:36 am, Russell Keith-Magee
wrote:
> On Wed, Jan 20, 2010 at 3:42 AM, Collin Anderson
>
> wrote:
> > Is there anyway to have the filter only apply to the annotation, so it
> > would return all publishers, with some having a
On Jan 18, 10:58 pm, stephendwolff wrote:
> I'm having problems authenticating an http POST from a java applet
> (which is loaded from a fully authenticated django view).
I had to do a similar thing from flash. I ended up manually putting
the session cookie into the
> Just as I feared. Thanks for the reply.
It's not as bad as you fear! Just escape it, then apply your filter,
then mark it all safe.
You'll find the escape function in django.utils.html
Peter
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
> I can use clean() method of form to od validation, but I embedded some
> complex rules in field validation and dont want to repeat the code
This. Use the clean method, you'll have to add add errors to the error
dict if you want them to appear by the field.
Not sure I follow why you would have
You've got to decide what you want to allow. If the users are trusted
you could allow them to input HTML, then you have to make sure its
marked as safe so the HTML is not escaped.[1]
Alternatively you could use a markup language that can be converted to
HTML.[2]
If you just want the newlines,
In your template tag you can add the variable to the global context
like this:
context.dicts[-1]['last_upload'] = whatever
Pete
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
Whoops, didn't actually try that as I'm not at my normal pc, I just
remembered reading it somewhere.
Thinking about it now, you can actually just do:
{{ my_list|last }}
Pete
On Dec 7, 8:35 pm, Gaffar Overcomes wrote:
> hey pete this does not work :S
> negative index
Try:
{{ my_array|slice:"-1:" }}
Pete
--
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.
> if not cleaned.has_key("string2") and
> cleaned.has_key("string1"):
> cleaned["string2"] = string1
>
> return cleaned
>
I think the problem here is that if string2 is not required it will be
in the cleaned dictionary but an empty string. So instead you might
need:
if
In addition to the above, cleaning that requires two fields is best
put in the forms overall clean method. This makes it a bit harder
because you can't raise a validation error if you want the error to
appear by the field, you have to insert it into self._errors.
Also, I have an even simpler
> - first try for empty record, expecting an empty Project-object to be created
> from the form automatically:
> projectForm = forms.ProjectForm()
> projectForm.save()
> => result: 'ProjectForm' object has no attribute 'cleaned_data'
You need to run the clean method on the form to make sure the
> I tried
>
> search_fields = ['school__lawyer']
>
> but I get an error message when I did a search for last name of
> lawyer:
>
> Related Field has invalid lookup: icontains
You need something like:
search_fields = ['school__lawyer_last']
to specify which field on the related 'lawyer'
> > > Hello, I want to make a field optional (blank=True), only if another
> > > text field's options match a certain value in the admin. Is there any
> > > way to do this? Thanks!
You want to do this in a modelform, and then specify that model form
in your admin.py. Put the checks in the
YUI has a great library for this. Should be fairly easy to integrate
with django, but I haven't seen a snippet for it. Should save you some
time on the client side though.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
I've done this exact thing before, I had to package apache, django, my
project and a ton of other packages that I needed. I found the easiest
way in the end was using nsis(1). I packaged django up as an msi(2),
got python and apache as msi installers, mod_python as an exe and then
just had it
On Oct 30, 5:47 am, Anthony Simonelli wrote:
> Is there any way to display the fields as text rather than as input fields?
My suggestion would be to write your own widget that simply renders as
text, and make all the uneditable fields use that widget. Have a look
in the
Try using a lambda function. The problem is that the factory wants a
callable that creates a form, not a form instance (ie it wants to be
able to execute MyForm() for each form in the formset.
Formset = inlineformset_factory(ModelA, ModelB form=lambda: MyForm
(readOnly=True))
Note I've not
ally a good design consideration.
>
> Of course this advice might not really apply to your problem - it's
> just a suggestion
>
> -Chip
>
> On Oct 16, 8:49 am, "pjrhar...@gmail.com" <pjrhar...@gmail.com> wrote:
>
> > I have some template code
>
> {% if var1 %}
> {{ var1 }}
> {% else %}{% if var2 %}
> {{ var2 }}
> {% else %}{% if var3 %}
> {{ var3 }}
> {% endif %}{% endif %}{% endif %}
>
> On Oct 16, 9:49 am, "pjrhar...@gmail.com" <pjrhar...@gmail.com> wrote:
>
> > I have s
I have some template code which looks something like this:
{% if condition %}
{% get_latest parameter1 %} - foo
{% else %}
{% get_latest parameter2 %} - bar
{% endif %}
get_latest is a custom template tag, and I noticed that in my
debugging output it is being run both times - ie with parameter1
51 matches
Mail list logo