Siah schrieb:
> Hi,
>
> The following code fails on windows, and works just fine on my unix
> box. To fix the problem in windows, I must replace('%', '%%') so its
> internal string formatting doesn't fail on me. Should I file this bug
> for psycopg2?
>
> from django.db import connection
> cursor=c
On Dec 1, 11:14 am, Fabio Natali <[EMAIL PROTECTED]> wrote:
> Hi everybody!
>
> I'm having difficulties while trying to insert a zip-code field in one
> of my models. I'd like to rely upon some italian local flavor stuff,
> so to get some validation for free.
>
> Here comes my models.py:
>
> fro
>
> Did you happen to read the official Django documentation on model
> formsets? In model formsets there are two factory functions.
> modelformset_factory and inlineformset_factory. The latter is a subset
> of the former and makes it easier to work with related objects through
> a foreign key. T
Hi,
I'd like to have a sliced query set in random order.
I tried
coupon_items = Item.objects.order_by('?')[:25]
,it seemed to work first but than I noticed that coupon_items consists
of doubled items (although all Item objects are distinct).
coupon_items = Item.objects.all()[:25].order_by('
> coupon_items = Item.objects.all()[:25]
> random.shuffle(coupon_items)
>
> doesn't word because a QuerySet object does not support item
> assignment, which is used by random.shuffle.
You might be able to cast the queryset as a list and then use
random.shuffle:
coupon_items = list(Item.ob
On 1 déc, 20:10, Stefan <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm new to Django and have some problems on how to create the models.
>
> What I want to do is something similar to a spreadsheet, but with more
> than one data field per intersection.
>
> Basically like this: (http://dpaste.com/hold/
I did as you said. Still its giving the same error :(
On Dec 2, 11:38 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2008-12-01 at 22:20 -0800, Vicky wrote:
> > I tried the code below:
>
> > from django.template import loader, Context
>
> > def NewspaperSelect(request,u_id):
> >
>
> I want to define a class inherited from a contrib class namely users
> and replace it with the new one .
> Long ago there was a replace_module keyword in the meta class of the
> model , any idea how to achieve
> this ?
First of all, why do you want to replace the contrib User model with
your
>
> 2. Is there any built-in opton in Django (0.97 version) to unzip
> files. I would need to unzip the file to a folder once the upload has
> been done.
Python provides libraries to handle zip files. Here's the starting
point:
http://www.python.org/doc/2.5.2/lib/archiving.html
-Rajesh D
--~--~
On Dec 2, 2008, at 5:50 PM, Vicky wrote:
>
> I did as you said. Still its giving the same error :(
Are you using forward slashes instead of backslashes? The docs
indicate that's necessary...
>
>
>
>
>
> On Dec 2, 11:38 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>> On Mon, 2008-12-0
Before getting the value you must check of its types which type is you
can not find the difference between DateObject-StrObject so you have
to have same kind of datatype
second thing open your terminal write python
>>import datetime
>>help(datetime)
which will list you all the function.
there is o
On Tue, Dec 2, 2008 at 3:42 AM, Vince <[EMAIL PROTECTED]> wrote:
> 2. Is there any built-in opton in Django (0.97 version) to unzip
There is no such thing as "Django 0.97". Releases of Django are as follows:
0.90
0.91
0.95
0.96
1.0
(with minor bugfix releases on several of them, like "0.96.1" a
Hello Django-People,
we use the embedded functionality of the user authentication in
Django.
We use folowing models: "user", "auth_group", "auth_user_group" and
other embedded models that does not matter in this context.
We would like to add the additional entity "area" with M-to-M relation
to th
If I understood you problem:
{{{
from django.contrib.auth.models import Group
class Area(models.Model):
groups=models.ManyToManyField(Group)
}}}
This creates a Many-To-May relation to Group.
Copied from brain to keyboard (untested)
HTH,
Thomas
nucles schrieb:
> Hello Django-People,
>
>
On 2 déc, 08:58, Eric <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I'm new at Django, but I've been having relatively good luck. I've
> recently hit a big of a wall using FileField. I have set up the paths
> correctly enough that I can upload files to /my_site/uploads/photos,
> but when I view the mo
I find the problem:
The validation was performed also on new extra widget because I have
added a field that was always valorized then the self.has_changed
property was always true then the validation was performed also for
the new extra widget. Now the field is empty by default.
But now another p
Dear Sergio, thank you very much for your reply.
sergioh wrote:
[...]
> from django.contrib.localflavor.it.forms import ITZipCodeField
> from django import forms
> from django.utils.translation import ugettext_lazy as _
>
> class DittaDipendentiAdmin(admin.ModelAdmin):
> cap = ITZipCodeFiel
>
> I did read this documentation, and was confused because I read this:
>
> >>> from django.forms.models import inlineformset_factory
> >>> BookFormSet = inlineformset_factory(Author, Book)
> >>> author = Author.objects.get(name=u'Orson Scott Card')
> >>> formset = BookFormSet(instance=author
>
hi,
class BookAdmin(admin.ModelAdmin):
pass
# admin.site.register(Book, BookAdmin)
Just put '#' in front of admin.site.register(Book, BookAdmin) .Now run the
server ,if it s ok then remove the #
On Tue, Dec 2, 2008 at 12:47 PM, Roland van Laar <[EMAIL PROTECTED]> wrote:
>
> djan wrote:
> >
Hi everyone,
I'm new to django so perhaps those are really simple questions so
sorry about that:
I had an php page already working (css formatted, imgs and
everything), it's a very simple page for uploading zip files to a
server. The server (system Apache 2.2.4 with django) has already the
main
Hi Everybody,
I want to define a class inherited from a contrib class namely users
and replace it with the new one .
Long ago there was a replace_module keyword in the meta class of the
model , any idea how to achieve
this ?
--~--~-~--~~~---~--~~
You received th
Hi,
I want to get all objects where the corresponding many-to-many field is
empty.
Example: get all users without a group
My solution:
User.objects.exclude(groups__in=Group.objects.all())
I think this is not optimal, since Group.objects.all() gets evaluated.
Resulting SQL:
SELECT "auth_
Worked like a charm...
Thanks!
>
>> coupon_items = Item.objects.all()[:25]
>> random.shuffle(coupon_items)
>>
>> doesn't word because a QuerySet object does not support item
>> assignment, which is used by random.shuffle.
>
> You might be able to cast the queryset as a list and then use
> random
Hi,
Maybe my TimedeltaField helps you:
http://www.djangosnippets.org/snippets/1060/
K*K schrieb:
> As you know time data type in mysql allow to be used more than 24
> hours, but when there is a more than 24 hours record in the table
> such as 72:00:00, and then query the table with Django ORM,
I've searched for the admin CSS guide, and found it deprecated (http://
docs.djangoproject.com/en/dev/obsolete/admin-css/?from=olddocs), is
there a replacement?
Thanks,
John M
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
All the python frameworks seem to do this: one web-server for
development, another for production. There may be a good reason for
this, but I don't see it.
If you are doing internet development, then you certainly have a
network. So why not develop on one box, and then move the files to
another?
Thanks, that's good to know.
-Josh
--~--~-~--~~~---~--~~
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 this group, send emai
On 2 Gru, 16:45, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to get all objects where the corresponding many-to-many field is
> empty.
>
> Example: get all users without a group
[...]
The preferred solution is using the `isnull` filter:
User.objects.filter(groups__isnull=True)
On 2 déc, 17:46, walterbyrd <[EMAIL PROTECTED]> wrote:
> All the python frameworks seem to do this: one web-server for
> development, another for production. There may be a good reason for
> this, but I don't see it.
Err... Not breaking whatever on the production server, perhaps ? FWIW,
this is n
Thanks! That's really helpful.
So, in a production environment, you'd set up the MEDIA_ROOT to be
somewhere within the generally accessible web-root, right?
-E
On Dec 2, 3:28 am, bruno desthuilliers <[EMAIL PROTECTED]>
wrote:
> On 2 déc, 08:58, Eric <[EMAIL PROTECTED]> wrote:
>
> > Hi!
>
> > I
On Dec 2, 4:46 pm, walterbyrd <[EMAIL PROTECTED]> wrote:
> All the python frameworks seem to do this: one web-server for
> development, another for production. There may be a good reason for
> this, but I don't see it.
>
> If you are doing internet development, then you certainly have a
> network.
Thanks for pointing me in the right direction. Here's the solution I
came up with:
import socket, struct
class ipfield(models.Field):
__metaclass__ = models.SubfieldBase
def db_type(self):
return 'integer'
def to_python(self, value):
retu
Bruno: Thanks, I think that is exactly what I needed. I thought that I
might need a model for the entries (you called them PersonItem), but I
wasn't sure since I'm new to this kind of programming and thought
there might be a more efficient way.
Dan: Just imagine a spreadsheet, like OpenOffice Cal
You could do User.objects.exclude(groups__in=Group.objects.all
().query) which will actually generate a subquery.
Alex
On Dec 2, 10:45 am, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to get all objects where the corresponding many-to-many field is
> empty.
>
> Example: get all u
On Monday 01 December 2008 9:01:11 pm Bobby Roberts wrote:
> > http://www.python.org/doc/2.5.2/lib/datetime-timedelta.html
>
> yeah i said I don't understand this.
I found datetimes easier to deal with when I used the modules found here:
http://labix.org/python-dateutil
As as an example for
I'm coming late to this thread -- this example is exactly what I was
looking for, so thanks for posting this.
I'm doing something where I want admins to be able to define an
arbitrary number of Collections which are just different orderings and
combinations of a (relatively) small set of Things.
I worked in a script that makes a full django environment setup on dreamhost
http://gabrielfalcao.com/2008/12/02/hosting-and-deploying-django-apps-on-dreamhost/
Hope whis help someone!
--
:wq
Atenciosamente
__
On Nov 26, 6:07 am, Justin Bronn <[EMAIL PROTECTED]> wrote:
> I created an Ubuntu 8.10 VM to try and test out this problem.
> However, the only way that I could reproduce your exact problem
> (segfault upon HTTP request) is when using the mpm-worker (threaded)
> Apache. When using the prefork,
Hi.
I am using Django v1.0. When I use the "fields" attribute in my model
to tell the admin interface what fields to display on the change form,
I find that any fields I leave out get truncated when I use the form
to update a record.
For instance, say I have a model class called "Users" that has
Hi ,
I did considered , but I could not see how to do it , the model I want
to inherit is from
contrib.Users and the model I want to replace is contrib.Users .
It looks to me like a circular reference ...??
How can I use the inherited model in the model I inherited from ??
Sandro
On Dec 2, 12:1
@Daniel and Bruno,
Thanks a lot it is working !
--~--~-~--~~~---~--~~
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 this group,
Hi,
I've set the player form with:
class PlayerForm(forms.Form):
challengeable = forms.BooleanField(required=False)
show_name = forms.BooleanField(required=False)
country = forms.ModelMultipleChoiceField(queryset=Country.objects.all())
and the template with:
I've a problem to se
On Dec 2, 9:04 pm, "Alfredo Alessandrini" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I've set the player form with:
>
> class PlayerForm(forms.Form):
> challengeable = forms.BooleanField(required=False)
> show_name = forms.BooleanField(required=False)
> country = forms.ModelMultipleChoiceFie
Thanks a lot. For some reason I haven't noticed the relevant fragment
in the docs...
Cheers,
-- Richard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email
> I am using Django v1.0. When I use the "fields" attribute in my model
> to tell the admin interface what fields to display on the change form,
> I find that any fields I leave out get truncated when I use the form
> to update a record.
>
> For instance, say I have a model class called "Users" th
> I did considered , but I could not see how to do it , the model I want
> to inherit is from
> contrib.Users and the model I want to replace is contrib.Users .
> It looks to me like a circular reference ...??
> How can I use the inherited model in the model I inherited from ??
It's still not cle
I have been following along to the excellent James Bennet Book,
Practical Django Projects and he suggests creating apps in a directory
that can be reusable for local development.
I am working on OSX (tiger and Leopard on different machines) and I
have created a Django director inside my /User/Sit
I prefer to to just put the apps in the project's folder and put *that*
folder on the PYTHONPATH then move it elsewhere only when I find out I
actually need it elsewhere. To make it more portable, I find out where my
project is in my filesystem at runtime so if I move it around, it's no
problem.
S
Thanks for the reply I'll give that a try.
Just one question does that mean you make a structure like so ?
Project
settings.py
urls.py etc
__init__.py (this is where above code goes)
>>>apps
>blog
>>>__init__.py
>>>models.py
>>>views.py
so that means in your installed_apps you
Hi all, I've been stumped by this error for the past few days and
haven't made any progress. Could someone please help out?
I've created a formset of seven entries, one for each day of the
previous week. The first submission works fine; all seven entries are
successfully submitted. Subsequent s
For what it's worth, I'm a huge fan of virtualenv:
http://pypi.python.org/pypi/virtualenv
and of Doug Hellmann's virtualenvwrapper:
http://www.doughellmann.com/projects/virtualenvwrapper/
What virtualenv does, basically, is create an isolated Python
environment into which you can install stuff
That would work but I put them right at the root of my project, not in an
app folder so I just add 'blog' to my INSTALLED_APPS. Every distributable
app I saw is meant to be put somewhere directly in the PYTHONPATH and not in
a subpackage so I follow that rule.
If you put them inside an folder name
Thanks for both tips. James I will trial the virtual environment and
if I get stuck can use Dan's method.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to dj
Does anyone have a code sample that shows how to create a pdf document
and then, without saving that document to disk, email it as an
attachment?
I am using the ReportLab PDF library at the platypus level for pdf
creation.
For emailing, I expect to use Django's EmailMessage class.
Thanks!
--~
Posting to geos-devel, I got this reply from Paul Ramsey:
http://lists.osgeo.org/pipermail/geos-devel/2008-December/003800.html
Leading me to: http://sgillies.net/blog/829/shapely-1-0-8/
"The same problem [segfault] could afflict any python package that
uses Ctypes on 64-bit systems without expl
On Dec 3, 1:40 pm, rcoup <[EMAIL PROTECTED]> wrote:
> Leading me to:http://sgillies.net/blog/829/shapely-1-0-8/
>
> "The same problem [segfault] could afflict any python package that
> uses Ctypes on 64-bit systems without explicitly marking argument and
> return types. "
The relevant changeset i
I'm a new user to django and am attempting to go through the Sams
"Teach Yourself Django in 24 hours" book and am having an issue
related to the chapter on saving form data. I'm hoping someone can
give me a hand.
I'm using Django 1.0
Here's my model:
class Person(models.Model):
userID = m
On Tue, Dec 2, 2008 at 5:09 PM, Margie <[EMAIL PROTECTED]> wrote:
>
> I'm a new user to django and am attempting to go through the Sams
> "Teach Yourself Django in 24 hours" book and am having an issue
> related to the chapter on saving form data. I'm hoping someone can
> give me a hand.
>
> I'm
Hi,
I know about the serialisation framework, but with MultiResponse[1] you
can't really use it (and anyway I don't know how to customise it
extensively). As a result I would like to create json with the django
template engine.
An example code would be this:
[{% for poll in data %}
{"question":
Thank you so much - that was a huge help!
Margie
On Dec 2, 5:17 pm, "Colin Bean" <[EMAIL PROTECTED]> wrote:
> On Tue, Dec 2, 2008 at 5:09 PM, Margie <[EMAIL PROTECTED]> wrote:
>
> > I'm a new user to django and am attempting to go through the Sams
> > "Teach Yourself Django in 24 hours" book an
I can confirm that all of my seg faults were all on my 64 bit machine
but could not be duplicated when I tried to on my 32 bit test virtual
machines.
On Dec 2, 7:40 pm, rcoup <[EMAIL PROTECTED]> wrote:
> Posting to geos-devel, I got this reply from Paul
> Ramsey:http://lists.osgeo.org/pipermail
I am interested to see if anyone could share their solutions for
ensuring pretty HTML output.
I have found achieving it to be a very uncomfortable compromise in
that I seem to need to make my templates almost unreadable to do so,
which isn't really a practical solution.
Perhaps nicely formatted
On Dec 2, 2008, at 5:50 PM, Vicky wrote:
>
> I did as you said. Still its giving the same error :(
Do you have the correct permissions on the TEMPLATE_DIRS directories?
Have you written the paths with forward slashes? That's all I can
think of.
E
>
>
>
> On Dec 2, 11:38 am, Malcolm Tredin
Thank you for your reply, Rajesh. The two fields in question are
actually "pending_referrer_name" and "pending_referrer_email". In the
admin class code below, I include them in the fields attribute.
However, initially I did not and that is when the problem would occur.
Here is the model code:
cl
On Tuesday 02 Dec 2008 10:16:48 pm walterbyrd wrote:
> All the python frameworks seem to do this: one web-server for
> development, another for production. There may be a good reason for
> this, but I don't see it.
it is not compulsory to use it - I develop and deploy using apache and
mod_python
On Tuesday 02 Dec 2008 7:53:25 pm Praveen wrote:
> second thing open your terminal write python
>
> >>import datetime
> >>help(datetime)
dir(datetime)
--
regards
KG
http://lawgon.livejournal.com
--~--~-~--~~~---~--~~
You received this message because you are sub
On Wednesday 03 Dec 2008 8:49:31 am Kenneth Gonsalves wrote:
> > All the python frameworks seem to do this: one web-server for
> > development, another for production. There may be a good reason for
> > this, but I don't see it.
>
> it is not compulsory to use it - I develop and deploy using apach
Thanks for the replies. I restarted the dev server (and even my x
session).
I first tried:
class BookAdmin(admin.ModelAdmin):
pass
#admin.site.register(Book, BookAdmin)
class AuthorAdmin(admin.ModelAuthor):
pass
#admin.site.register(Author, AuthorAdmin)
class PublisherAdmin(admin.ModelP
Thanks for the replies. I restarted the dev server (and even my x
session).
I first tried:
class BookAdmin(admin.ModelAdmin):
pass
#admin.site.register(Book, BookAdmin)
class AuthorAdmin(admin.ModelAuthor):
pass
#admin.site.register(Author, AuthorAdmin)
class PublisherAdmin(admin.ModelP
Pardon me.
I incorrectly followed the suggestion, should have been the following
in admin.py:
admin.site.register(Book)
admin.site.register(Author)
admin.site.register(Publisher)
What is the difference between this and, say,
class BookAdmin(admin.ModelAdmin):
pass
admin.site.register(Book, B
On Tue, 2008-12-02 at 08:21 -0800, John M wrote:
> I've searched for the admin CSS guide, and found it deprecated (http://
> docs.djangoproject.com/en/dev/obsolete/admin-css/?from=olddocs), is
> there a replacement?
You can still customise the admin CSS. I suspect it just hasn't been
documented
On Tue, 2008-12-02 at 18:39 -0800, Tonne wrote:
> I am interested to see if anyone could share their solutions for
> ensuring pretty HTML output.
>
> I have found achieving it to be a very uncomfortable compromise in
> that I seem to need to make my templates almost unreadable to do so,
> which
Confirmed also. only happens on my 64-bit machine, and is not related
to apache at all as I can reproduce it faithfully in ipython.
On Dec 2, 8:32 pm, GRoby <[EMAIL PROTECTED]> wrote:
> I can confirm that all of my seg faults were all on my 64 bit machine
> but could not be duplicated when I trie
try this
def set_language(request, lang_code):
next = request.REQUEST.get('next', None)
if not next:
next = '/'
response = http.HttpResponseRedirect(next)
if lang_code and check_for_language(lang_code):
settings.LANGUAGE_CODE=lang_co
To trim last colon wrap it with if statement:
{% if forloop.revcounter0 %},{% endif %}
On Wed, Dec 3, 2008 at 04:26, Viktor Nagy <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I know about the serialisation framework, but with MultiResponse[1] you
> can't really use it (and anyway I don't know how to cust
On Wed, Dec 3, 2008 at 1:17 AM, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>
> To trim last colon wrap it with if statement:
>
> {% if forloop.revcounter0 %},{% endif %}
You can also do:
{% if not forloop.last %},{% endif %}
Which, IMO, is slightly more clear.
---
David Zhou
[EMAIL PROTECTED]
Oh, Yes. Good point.
On Wed, Dec 3, 2008 at 09:49, David Zhou <[EMAIL PROTECTED]> wrote:
>
> On Wed, Dec 3, 2008 at 1:17 AM, Alex Koshelev <[EMAIL PROTECTED]> wrote:
> >
> > To trim last colon wrap it with if statement:
> >
> > {% if forloop.revcounter0 %},{% endif %}
>
> You can also do:
>
> {%
Hi all, I'm quite newbie in Django.
I use template fragment caching ({% cache ...%}...{% endcache %}. This
fragment changes rather seldom, changes originate only from admin site,
są for me its obvious to delete cache at adding objects from admin, and
use quite large tiemeout for my caches.
How ca
78 matches
Mail list logo