category counter

2008-01-24 Thread Chris
hello again. thanks for all the help that everyone has offered me here. I have a generic django application called categories and it serves to provide categories for various apps suchas a weblog or an articles application. So a weblog and article app both have a M2M relation to the catergories ap

How to get sum of fields without using custom SQL?

2008-01-24 Thread shabda
My model is something like this, class Job(models.Model): name = models.CharField(...) class Entry(models.Model): job = models.ForeignKey(Job) hrs_worked = models.IntegerField() Now I want to get the sum of the hours worked in a job which I can get by summing Entries for that job. somet

can per-site cache work with per-view cache together?

2008-01-24 Thread [EMAIL PROTECTED]
my purpose is to cache the whole site for anonymous and cache serveral view for registered user also. first, i set these in per-site cache in settings.py: CACHE_BACKEND = 'memcached://100.13.192.7:11211/' CACHE_MIDDLEWARE_SECONDS = 600 CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True this means only cache

Re: How to use newforms ChoiceField to show dynamic choices

2008-01-24 Thread Nathaniel Whiteinge
ModelChoiceField. Currently not documented, but here's example code. Use your browser's find for "ModelChoiceField". http://www.djangoproject.com/documentation/models/model_forms/ On Jan 24, 9:47 pm, shabda <[EMAIL PROTECTED]> wrote: > I want to use the ChoiceField to show choices depending on

How to use newforms ChoiceField to show dynamic choices

2008-01-24 Thread shabda
I want to use the ChoiceField to show choices depending on a query set. For exmple the ChoiceField must get all active Users and them show them in a drop down, something like what happens in Admin. How can I do that? --~--~-~--~~~---~--~~ You received this message b

Re: warning on forking process?

2008-01-24 Thread michael
This is more likely a Python thing. Few understand the design decisions behindf Python or the effects they have on deployment. For example, if you use CherryPy which is threaded, you can borrow a lot of trouble by trying to use ZEO with it if you do it at the wrong level. Python process with 10

confusion over custom template tags

2008-01-24 Thread hifire
Greetings group! I've been trying to get this code to work: http://www.djangosnippets.org/snippets/282/ I created a templatetags folder in my app, and added __init__.py and usertags.py. I pasted the code from the snippets site into my usertags.py. I have a view define like this: @login_require

is it ok to use memcache for this function?

2008-01-24 Thread [EMAIL PROTECTED]
1. do not want to cache the whole site 2. do not want to cache only anounymous user with this in settings.py: CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True so can i use: 1. @cache_page(60 * 15) def slashdot_this(request): to cache pages for all user 2. use this in BASE.html to cache all page for a

warning on forking process?

2008-01-24 Thread [EMAIL PROTECTED]
I'm using the urllib module to do some backend transactions. I'm integrating paypal, and some other tools. In using the name-value-pairs of the paypal API's express checkout, I need to send some params to an API url. I do it like this within a function called by a view, where nvp is a dict of al

Re: custom managers and FOO_set

2008-01-24 Thread Eric Abrahamsen
> Can you include the code for your CustomManager.open() method? class OpenEntries(models.Manager): def open(self): now = datetime.now() entries = super(OpenEntries, self).get_query_set().filter(dispDate__lte=now).filter(isOpen=True) return entries datetime is importe

Re: Passing form initial values from one view to another?

2008-01-24 Thread Kenneth Gonsalves
On 24-Jan-08, at 10:59 PM, Dennis wrote: > Kenneth, that definitely wasn't my intention. I was just kidding - obviously you wouldn't have been so grateful as to send 10 thanks yous ;-) -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ Foss Conference for the common

Re: self-repeating form field

2008-01-24 Thread Russell Keith-Magee
On Jan 25, 2008 6:20 AM, Javier Rojas <[EMAIL PROTECTED]> wrote: > Hi list, > > I wrote a form field (newforms) that can "replicate" itself (source > attached). Is similar to the "add attachment" field on GMail; it works > with many django's newform fields (even ChoiceField, or IntegerField), > an

*Occasional* PostgreSQL Error

2008-01-24 Thread Doug Van Horn
I recieve the following error very *occasionally* from a couple of different django apps running against Postgres (some backtrace included for context): File "/opt/django/trunk/django/db/models/query.py", line 188, in iterator cursor = connection.cursor() File "/opt/django/trunk/django/db/b

Re: Truncated incorrect DOUBLE value

2008-01-24 Thread Matic Žgur
Ok, to sum up my monologue, I've rewritten my view to something like this (a short version): def show_entries_for_user(request, submitted_to): user = User.objects.get(username__exact=submitted_to) entries = user.submitted_by.all() for entry in entries: entry.entry = mark_safe

Re: Truncated incorrect DOUBLE value

2008-01-24 Thread Matic Žgur
Hmm, it's late now and I'm quite sleepy so I forgot to write that I changed my view to: def show_entries_for_user(request, submitted_to): user_id = User.objects.get(username=submitted_to) entries = Entry.objects.filter(submitted_to=user_id) for entry in entries: entry.entry =

Re: Truncated incorrect DOUBLE value

2008-01-24 Thread Matic Žgur
I solved this. I was passing a string instead of number (id of the user in user table) to submitted_to. Does anyone know if there is a better way of doing this, like passing a username to the foreignfield? Thanks, Matic On Jan 24, 2008 11:03 PM, Matic Žgur <[EMAIL PROTECTED]> wrote: > Hello ever

Truncated incorrect DOUBLE value

2008-01-24 Thread Matic Žgur
Hello everybody, I'm getting an error trying to get a QuerySet object. I've just started to work on a small ToDo list but I can't move on since I keep on getting "Truncated incorrect DOUBLE value: 'matic'" error. My model for the entry looks like this: class Entry(models.Model): submitted_b

self-repeating form field

2008-01-24 Thread Javier Rojas
Hi list, I wrote a form field (newforms) that can "replicate" itself (source attached). Is similar to the "add attachment" field on GMail; it works with many django's newform fields (even ChoiceField, or IntegerField), and has an almost-decent error handling (it there is a validation error, the va

Re: ForeignKey with null=True gives 'may not be NULL' error

2008-01-24 Thread michael
Hmmm, now the question is, is that intended for databases that can handle a temporary null in a foreign key? What DB are you using? I see that Postgres gives me no grief about null=True, since it sets up as CREATE TABLE licensing_server ( id int4 NOT NULL DEFAULT nextval('licensing_server_id_

Re: custom managers and FOO_set

2008-01-24 Thread Rajesh Dhawan
Hi Eric, > Is this possible, or should I just add a layer of filtering? And can > someone tell me where in the source code all this is going on? I tried > tracing the progress of the query set manager myself, to very little > avail. Can you include the code for your CustomManager.open() method?

.::: New Social Networking Site :::.

2008-01-24 Thread Mario Feonands
Hi !! How are you ? myLoveZone is a new social networking site designed for all the people around the world. Please support us by visiting our site. Visit Us @ Visit http://my.lovezone.ro Thank you very much. --~--~-~--~~~---~--~~ You received this message because

Re: vista install

2008-01-24 Thread michael
Hmmm, Several manufacturers, including Dell, are offering XP again. XP is to windows as democracy is to government, very bad, but all other forms are so much worse. Different "flavors" of Vista have different levels of security, so it is not surprising tht you are having a problem and someone e

Re: newforms.ModelForm: some customizing

2008-01-24 Thread Pigletto
> Would you be so kind to help me to solve some problems? I have some > questions. Good questions, as these are (I think) common problems and finding answers in documentation is not obvious (or not even possible sometimes). > 1. How may I use my own field DateField (I mean not forms.DateField) >

Re: Passing form initial values from one view to another?

2008-01-24 Thread Jorge Gajon
Hi Dennis, On Jan 23, 2008 9:19 PM, Dennis <[EMAIL PROTECTED]> wrote: > follow up here though. Once this is implemented you end up with the > redirect URL looking something like this: > > http://mygreatwebsite.com/django_app/process/?newcontext=22 > > Which seems okay, but I also have a couple o

newforms.ModelForm: some customizing

2008-01-24 Thread Kurilov Dmitry
Hello! Would you be so kind to help me to solve some problems? I have some questions. #There is Currency and Payment classes. class Currency(models.Model): name = models.CharField(max_length=100) short_name = models.CharField(max_length=3) sign = models.CharField(max_length=1) def

Re: Passing form initial values from one view to another?

2008-01-24 Thread Dennis
Kenneth, that definitely wasn't my intention. Google groups put up an orange exception when I hit "send" yesterday and raised a message that stated that my response couldn't be posted due to a system error. I tried a couple extra times & even logged out/back in and was still seeing the same resp

.::: iGame2 :::.

2008-01-24 Thread Mario Feonands
iGame2.com is a leading social network of video game culture, for gamers to post their gaming history, favorite games, accomplishments, blogs, news and more! Join a gamer community, create gamer profiles, and share gamertags. Listen to the iGame2 Podcast, read game reviews, win tournaments, and ge

Re: ForeignKey with null=True gives 'may not be NULL' error

2008-01-24 Thread Wyley
> No, it is not the case that null=True is disallowed for FKs, but it > probably should be. I've just been reading the code in django.db.models.fields.related, and there's a pretty clear indication that the Django developers explicitly wanted ForeignKeys to be nullable. In the RelatedManager cla

custom managers and FOO_set

2008-01-24 Thread Eric Abrahamsen
I thought I had understood this, but I guess not... I've got a simple multi-user blog setup, where blog entries might have a future publish date, or be marked "don't publish", in which case I don't want them coming out on the site. I've done this by replacing the 'objects' manager with a custom m

Apache & lighthttpd configuration

2008-01-24 Thread Grupo Django
Hello, I need some help to set up an apache+lighthttpd server. Now I have an apache server serving everything, including the media, but I'd like to follow the suggestions of the documentation and serve the media throught lighthttpd. I only have one server so I must run apache and lighthttpd in the

Re: Capability Problem With Django ORM

2008-01-24 Thread David Marquis
Hi xunSir, Personally, I can't understand your question. You will have to get some help with english speaking because what you wrote there is merely understandable. Thank you, -- David On 24-Jan-08, at 12:04 AM, xunSir wrote: class Person(models.Model): PIN = models.CharField(maxleng

My uppload form problem?

2008-01-24 Thread makkalot
Hi all i use django 0.96.1 version and i'm trying to upload file to server. Actually that is not the problem here my dropdown menus gone crazy :) I got an error that i have not entered a valid choice ! I have did that operation hundred times i can not understand whats wron! Here is my code htt

Re: how to serialize to xml object with many-to-many relationship?

2008-01-24 Thread sector119
Thank you very much! On 24 Січ, 15:58, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Jan 24, 2008 9:57 PM, sector119 <[EMAIL PROTECTED]> wrote: > > > > > Hi All! > > > I get a trouble when I try to serialize object with many-to-many > > relationship. All related objects have no values in

how to make django's sub dir rewritable?

2008-01-24 Thread ruby
can anyone give me a hint on how to add a rule to make the subdirectory redirect to a different directory under apache? where django mod_python using the same directory. suppose i have a dir "/dj" and have a subdir "/Web/js", my template's js src value is "js/myscript.js", I want the dir "/dj/js/

Re: how to serialize to xml object with many-to-many relationship?

2008-01-24 Thread Russell Keith-Magee
On Jan 24, 2008 9:57 PM, sector119 <[EMAIL PROTECTED]> wrote: > > Hi All! > > I get a trouble when I try to serialize object with many-to-many > relationship. All related objects have no values in xml, in db > everything is ok, why? > >rel="ManyToManyRel"> > > # HERE IS NO VALUES IN OBJECTS, W

Re: Link to other page in Admin interface

2008-01-24 Thread Ravi Kumar
or maybe you can define a {% block customURL %} {% endblock %} in base and define the URL later. This would be better approach over hard-coding that in base template. On Jan 24, 2008 6:48 PM, Nader <[EMAIL PROTECTED]> wrote: > > Thank you! You are right, I have to copy some templates as the > "ba

Re: Link to other page in Admin interface

2008-01-24 Thread Nader
Thank you! You are right, I have to copy some templates as the "base.html" and the "base_site.html" which are in "django/contrib/ admin" directory to my project directory. Then I can add this link to the "base.html" or "base_site.html" template, I don't know which one. But I have tried it for even

Re: Optimistic Locking

2008-01-24 Thread Thomas Guettler
Am Donnerstag, 24. Januar 2008 13:08 schrieb Tim Sawyer: > Hi Folks, > > I'm just evaluating django for use on a project. I have a multiuser > application where many users can be changing data at once. > > What's the status of hibernate style optimistic locking, where each object > has a version

Re: How to get a model's fk's host class?

2008-01-24 Thread Thomas Guettler
Am Donnerstag, 24. Januar 2008 05:02 schrieb xunSir: > class Person(models.Model): > PIN = models.CharField(maxlength=20, primary_key=True) > Name = models.CharField(maxlength=20) > > class Burse(models.Model): > PIN = models.ForeignKey(Person) > Cash = models.IntegerField() >

Re: newforms-admin replacement for core=True in inline models?

2008-01-24 Thread [EMAIL PROTECTED]
Hi James, > I have hit a wall with newforms-admin, which seems obvious but I can't > find mention of a solution anywhere. > > As I understand it, part of core=True was defining when the related > object was created or deleted. > > eg: "The related model being edited inline must specify one or mor

Re: vista install

2008-01-24 Thread HanibaL
Hi. In Windows XP my python part is "C:\Python25\" and "django-admin.py" after installation in "C:\Python25\Lib\site-packages\django\bin\". In CMD write "cd \Python25\Lib\site-packages\django\bin\" and then write "django-admin.py startproject mysite" Folder "mysite" will be creat in "C:\Python25\L

how to serialize to xml object with many-to-many relationship?

2008-01-24 Thread sector119
Hi All! I get a trouble when I try to serialize object with many-to-many relationship. All related objects have no values in xml, in db everything is ok, why? 132132 1 2008-01-24 14:51:32 # HERE IS NO VALUES IN OBJECTS, WHY? Thanks! --~--~-~

Re: Link to other page in Admin interface

2008-01-24 Thread Ravi Kumar
> > But I would like to > make a link in Admin page to go to other page directly. > So I want to go the page which I want for example with the next > statement: > > Go back to the Production page > > Where do I have to write this statement such that I can see it in > Admin page? > you can do cop

Optimistic Locking

2008-01-24 Thread Tim Sawyer
Hi Folks, I'm just evaluating django for use on a project. I have a multiuser application where many users can be changing data at once. What's the status of hibernate style optimistic locking, where each object has a version and update/deletes are prevented if the last saved version of that

Re: Escaping/unescaping HTML

2008-01-24 Thread bjornkri
Never mind this, I run xml.sax.saxutils.unescape() on the appropriate parts before putting them into the model. That seems to work. -Björn On Jan 24, 12:05 pm, bjornkri <[EMAIL PROTECTED]> wrote: > I'm working on a project that reads feeds from tumblr.com and displays > on my page. The api is a

Escaping/unescaping HTML

2008-01-24 Thread bjornkri
I'm working on a project that reads feeds from tumblr.com and displays on my page. The api is a simple xml file (http://beertje.tumblr.com/ api/read/), which I process with BeautifulSoup. Here's a sample tumblr post: http://beertje.tumblr.com/post/24484315"; type="quote" date="Wed, 23 Jan 2008 1

RE: vista install

2008-01-24 Thread Mat
This probably isn't of much help, but I'm running vista here, I did django-admin.py startproject testproject without any issues, certainly knows py as executable, I'm running python 2.5. Hope this helps, Mat From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Denis

newforms-admin replacement for core=True in inline models?

2008-01-24 Thread James T
Hi All, I have hit a wall with newforms-admin, which seems obvious but I can't find mention of a solution anywhere. As I understand it, part of core=True was defining when the related object was created or deleted. eg: "The related model being edited inline must specify one or more "core" field

Re: vista install

2008-01-24 Thread Denis Cornehl
Hi, I think Windows does noch have this feature on the command-line. Type "python django-admin.py startproject testproject". If your Python-installation is in the path, it will run. On Jan 24, 2008 9:46 AM, mtnpaul <[EMAIL PROTECTED]> wrote: > > Well I got a new laptop that has vista on it (no

Link to other page in Admin interface

2008-01-24 Thread Nader
Hallo, I have a question, maybe the answer is very easy but I don't know how I can solve that. I have a project which has some applications. I have used the "Admin" class in each application to do the "CURD" easily. But I would like to make a link in Admin page to go to other page directly. So I

vista install

2008-01-24 Thread mtnpaul
Well I got a new laptop that has vista on it (not my choice). I'm trying to install django, but keep getting the same strange message when I try to create a project C:\>django-admin.py startproject testproject results in the following Type 'django-admin.py help' for usage. I've tried both pytho