>
> But be sure to fix the typo in x first!
>
> >>> x = [ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ]
> File "", line 1
> x = [ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ]
> ^
> SyntaxError: invalid syntax
>
Ha, whoops. I
> Try this:
>
> x = [ {'id': 1, 'title': 'test1'}, {'id': 2, 'test2'} ]
> if x:
> d = x[0]
> q = Q(id=d['id']) & Q(title=d['title'])
> for d in x[1:]:
> q = q | (Q(id=d['id']) & Q(title=d['title']))
> query = MyModel.objects.filter(q)
Hey, that make
I've spent a little too much time on this, but before I decided to
make a custom sql query, I wanted to see if anyone could provide any
assistance. It is really a python question, and the problem I'm
having is I'm not an expert yet with python.
First, I have a list of dictionaries.
[ {'id': 1,
> That line is executed exactly once, at the time the file is imported. So
> it is not dynamic in any way.
>
> (I seem to be saying that at least every other day here. It's normal
> Python behaviour, people. Please stop hoping it were otherwise!)
Thanks for the help. I didn't call it dynamic, th
I'm wanting to have upload_to for my file so it uploads to a different
directory for each user. This works when I use it with a newform, but
when I try to use the Django admin, it puts None as the username (I
want to base it on whatever username I select for "user"). I'm using
some middleware fo
he request.META['PATH_INFO'] for zones
> where the middleware shouldn't do anything.
>
> On Mar 13, 4:47 pm, "Stephen Mizell" <[EMAIL PROTECTED]> wrote:
>
> > > You should go with a MiddleWare.
>
> > Will this work for the Django admin
> You should go with a MiddleWare.
Will this work for the Django admin as well? I don't think I
specified in my post that I was wanting to restrict the access in the
admin for certain users, but still make each Weblog public. Sorry for
the confusion.
--~--~-~--~~~-
I'm guessing this question has been answered somewhere, but I am
having a hard time finding an answer. I'll explain my question by way
of an example. Let's say I have a Weblog model which is related to a
Post model. I want many Weblogs on the site, and each Weblog can have
many Posts. My situa
nks for your help
Malcolm!
Stephen Mizell
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from thi
t; on month and year, we want new articles to
post the first day of each month. This is why I don't use now().
Thanks!
Stephen Mizell
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group
That's exactly what happened, but strange thing was it worked just fine
using the filter. I even tried making some SQL queries to fix them for me,
but that didn't work.
Oh well, it's over now ;)
On 1/10/07, James Bennett <[EMAIL PROTECTED]> wrote:
>
>
> On
Well, I gave up on the automation. I couldn't get restructuredtext to
work right in my views, so I swallowed my pride and went into
copy/paste mode. I simple did this:
{% load markup %}
{% for post in posts %}
{{ post.id }}
So it seems the issue is with the restructured text. When using the
restructured text filter on a template, it works just fine. When using
restructured text in a view, it gives me tons of errors.
Any ideas?
--~--~-~--~~~---~--~~
You received this message becau
In our database we have a TextField that stores the body of our posts
in RestructuredText. I've recently added TinyMCE to the Django Admin,
so I'm wanting to convert this field from rst to plain old html.
I wrote a little thing of code to do this with Django.
def convert_post(request):
filename = models.FileField(unique=True, upload_to="tick/resource",
null=True, blank=True)
I think I fixed the issue. I took out "unique=True" in the FileField
and this allowed me to upload with no problems.
Is this a bug or am I just using "unique" incorrectly?
--~--~-~--~---
We are using the admin for one our projects. In our model, we have:
class Resource(models.Model):
# ...
filename = models.FileField(unique=True, upload_to="tick/resource",
null=True, blank=True)
We were just uploading an excel spreadsheet, which we've had no trouble
doing in the past, an
27;, 'third_id']:
> if request.GET[key]:
> kwargs[key] = request.GET[key]
> Resource.objects.filter(**kwargs)
>
> (i didnt test it, but thats the idea i guess ...)
>
> > That just seems like the worst way to do it. Can I pass a dictionary
> > to it so
T['first_id'])
elseif
#... so on
That just seems like the worst way to do it. Can I pass a dictionary
to it somehow? What's the best way to do something like this?
Hope this wasn't extremely confusing. Let me know if you need any
other information from me.
Thanks a lot,
S
18 matches
Mail list logo