Re: Treat two fields as one in a queryset

2010-02-21 Thread shacker
Thanks for the suggestions. The "convert to list" approach sounded appealing, but I had to get back a queryset since this was for an RSS feed. After reading up more, finally decided it might actually make more sense to go with a bit of denormalization and create a "combined_date" field on the mode

Re: Django CMS

2010-02-21 Thread @ Rocteur CC
On 21 Feb 2010, at 04:38, Shawn Milochik wrote: I used the same comparison you did, and I ended up going with Django- CMS. I like it a lot. As for importing the content, that should be pretty easy. Once you see how Django-CMS works you'll just need to make a simple HTML template and then

How to Create models with columns not corresponding to database.

2010-02-21 Thread Amps
Hi I am new to Django. I am trying to use admin module to generate some reports from data in Mysql database. The query is a complex query which involves group by and joins. The resulting columns of the query are not in database, since they are custom/created during the query. I want to create a

Re: How to Create models with columns not corresponding to database.

2010-02-21 Thread Shawn Milochik
From your question, it is clear that you don't understand what the admin app is. At least do the Django tutorial before you start asking how to do things. Your question is like asking how to use PHPMyAdmin to create this report. Shawn -- You received this message because you are subs

Re: How to Create models with columns not corresponding to database.

2010-02-21 Thread Amps
ok i had read, but was unclear ... ok, now , i am not using admin module. but can we create a model model.py which doesnt reflect any table/ columns in the database, but should reflect a report columns. On Feb 21, 5:43 pm, Shawn Milochik wrote: >  From your question, it is clear that you don't un

Re: How to Create models with columns not corresponding to database.

2010-02-21 Thread Amps
ok i had read, but was unclear ... ok, now , i am not using admin module. but can we create a model in model.py which doesnt reflect any table/ columns in the database, but should reflect a report columns. On Feb 21, 7:15 pm, Amps wrote: > ok i had read, but was unclear ... ok, now , i am not usi

Do Django TestCases reload fixtures on every method?

2010-02-21 Thread bobhaugen
I see here http://toastdriven.com/fresh/whats-wrong-django-slight-return/ a claim that "TestCase-style tests truncate and reload all the fixtures in your database on every test method". Is that true? If so, how would I create a series of test methods that build on each other: for example, one vie

Re: How to Create models with columns not corresponding to database.

2010-02-21 Thread Atamert Ölçgen
On Sunday 21 February 2010 16:16:56 Amps wrote: > ok i had read, but was unclear ... ok, now , i am not using admin > module. > but can we create a model in model.py which doesnt reflect any table/ > columns in the database, but should reflect a report columns. AFAIK no. A practical approach could

Re: Do Django TestCases reload fixtures on every method?

2010-02-21 Thread Russell Keith-Magee
On Sun, Feb 21, 2010 at 11:20 PM, bobhaugen wrote: > I see here http://toastdriven.com/fresh/whats-wrong-django-slight-return/ > a claim that "TestCase-style tests truncate and reload all the > fixtures in your database on every test method". > > Is that true? Yes. From the docs [1]: """ This flu

Re: Do Django TestCases reload fixtures on every method?

2010-02-21 Thread bobhaugen
On Feb 21, 9:43 am, Russell Keith-Magee wrote: > It sounds like what you actually want to write is one long test, > rather than N order dependent short tests. If you want to break things > into methods for the sake of clarity/code organization, you can - just > break the test_* entry method into s

Re: what if I need to use two objects to get a third object in my templates?

2010-02-21 Thread Jeremy Dillworth
You could also put a columns property onto each person object. Given the models: class Person(models.Model): name = models.CharField(max_length=30) class DataPoint(models.Model): person = models.ForeignKey(Person) value = models.IntegerField() and a view named list: def list(reques

How to make the login forms available to the entire site?

2010-02-21 Thread Patrick
I thought that if I put the login forms on the base template and then extend all others from that base template, the login forms would be available all the way through. But there is a problem: the login forms are only displayed if the url is processed by the 'login' view. That login view provides t

Re: Passenger 57 - a Django query problem

2010-02-21 Thread Sithembewena Lloyd Dube
Thank you everybody. Chapter closed. On Sun, Feb 21, 2010 at 4:11 AM, Steven Elliott Jr wrote: > I've always found both the Django and Python communities to be among the > friendliest and most helpful. Please be kind to one another and respectful > of everyones comments. We are here to support on

Re: Passenger 57 - a Django query problem

2010-02-21 Thread derek
First off - my apologies to all who have replied so diligently without so much as a "hi" from me before now... soon after posting this I fell ill and did not have an opportunity to reply. Second; I posted this same message three days ago and for some unknown reason, it did not show up on the mail

Re: choices in model field error

2010-02-21 Thread carlos
hi copy de code in first line your models.py or views.py # -*- coding: UTF-8 -*- bye :) On Thu, Feb 18, 2010 at 7:55 PM, Karen Tracey wrote: > On Thu, Feb 18, 2010 at 11:18 AM, hooda_28 wrote: > >> hi im having a problem for about an hour now, i have a model >> >> class Dummy(models.Model):

Re: Creating new Thread in a view?

2010-02-21 Thread Eric Chamberlain
On Feb 17, 2010, at 9:36 AM, justind wrote: > > What is a better solution to this problem? Actually, I feel like I > can't solve it because I lack an understanding at what's happening > where Django touches Apache and I'd like to fill that gap, so in > addition to help with this particular probl

Re: How to make the login forms available to the entire site?

2010-02-21 Thread Timothy Kinney
There may be a more elegant way, but I think you could just call the login view from whatever view the url directs the user too. So it fills in the login info and then renders the rest of the page...but on second thought maybe you need to include the login form in every view... On Sun, Feb 21, 2

how to get as_sql() to work again

2010-02-21 Thread felix
As of 1.2 and multi-db how do I get the sql that will be produced from a query set ? Since 1.2 and multi-db, the previous methods are no longer working. Its been said here that we shouldn't depend on internal functions as they may change. However getting the SQL that will be produced is essential

Re: How to Create models with columns not corresponding to database.

2010-02-21 Thread Timothy Kinney
Maybe the problem is that you don't quite understand what models are for. If you just want to create a report from your SQL data you use the models to structure the data and define relationships, not to report it. You use the views and the templates to generate the actual report. Does that make se

Re: Ajax request, json object, fields with instance of inherits class converted in regular string

2010-02-21 Thread Kev Dwyer
On Fri, 19 Feb 2010 07:00:36 -0800, manixor wrote: > > The very big problem is, when I loop into object on template, in the > monday field is not enymore the Day instance, but the string 1. How can > I convert to an json object the week object, and to keep the instance of > the inherits class, o

Re: How to make the login forms available to the entire site?

2010-02-21 Thread rebus_
On 21 February 2010 19:38, Timothy Kinney wrote: > There may be a more elegant way, but I think you could just call the login > view from whatever view the url directs the user too. So it fills in the > login info and then renders the rest of the page...but on second thought > maybe you need to in

update

2010-02-21 Thread shofty
just wanted to add in that i worked out that this was due to changing the PIL installed on my local box. don't know if there is a bug, suspect it was more that i coded the solution around 1.6 then upgraded to 1.7 for something else, which unfortunately broke this app. -- You received this message

Re: what if I need to use two objects to get a third object in my templates?

2010-02-21 Thread Jeremy Dillworth
On Feb 21, 11:14 am, Jeremy Dillworth wrote: > and a view named list: > > def list(request): >     people = Person.objects.all() >     for p in people: >         p.columns = [None, None, None] >         for c in DataPoint.objects.filter(person=p, value__gt=4): >             p.columns.append(c) > >

apparent bug in QuerySet

2010-02-21 Thread felix
This seems so blatant that it couldn't really be a bug without someone noticing. Django 1.2 qs = Apt.objects.filter(list_on_web=True,is_available=True) # FastAdderStatus has Apt and Service as fk qs = qs.filter(fastadderstatus__service=self.service) # later on h

Re: how to get as_sql() to work again

2010-02-21 Thread felix
from django.db import connections def dbug(): pdb.set_trace() def qbug(qs,caption=""): connection = connections['default'] aa,bb=qs._as_sql(connection) print caption, aa % bb return qs -- You received this message because you are subscribed to the Google Groups "Django us

django and caching

2010-02-21 Thread Itay Donenhirsch
hi folks, a little question: when using any caching mechanism (say, memcache) with django, how does django know when to "refresh" the cache? a scenario for example: 1. user gets a page, gets page content A 2. someone changes the state of the database so A -> A' 3. user refreshes the same page, doe

Re: django and caching

2010-02-21 Thread cootetom
Hi, The user gets A. Django's caching doesn't know that the database data changed. You could override the save method on the model so that when data is saved you clear the cache, or update the cache maybe. On Feb 21, 9:22 pm, Itay Donenhirsch wrote: > hi folks, a little question: when using

have trouble with safe and linebreaks together

2010-02-21 Thread Ali Rıza Keleş
Hi all, I have a problem about template language. In my model there is a text field for body text of entries. And I markup my text with some html. Like below: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "Ut enim a

Re: django and caching

2010-02-21 Thread Christophe Pettus
On Feb 21, 2010, at 1:22 PM, Itay Donenhirsch wrote: hi folks, a little question: when using any caching mechanism (say, memcache) with django, how does django know when to "refresh" the cache? a scenario for example: 1. user gets a page, gets page content A 2. someone changes the state of the

Best practices for restricting media?

2010-02-21 Thread Brett Thomas
Hey, this is a pretty basic sysadmin question, but seems pretty critical for django development. What's the best way to limit media on a django site to certain users? A typical example is a photo gallery app. Suppose you are recreating Flickr, and a user's photos should only be viewable by his/her

Re: have trouble with safe and linebreaks together

2010-02-21 Thread cootetom
You have a mix of techniques here. You are allowing markup to be saved into the database and then when being displayed in a template you are again adding mark up there to! Why don't you have a model which has a "title" field and a "body" field. That way the user doesn't have to get involved with en

Re: django and caching

2010-02-21 Thread Itay Donenhirsch
Thanks for the replies folks, you've been very helpful. One more question though - I didn't find any "official" way to clear the cache of a certain object. Any suggestions? On Sun, Feb 21, 2010 at 11:52 PM, Christophe Pettus wrote: > > On Feb 21, 2010, at 1:22 PM, Itay Donenhirsch wrote: > >> hi

Re: Union of two query sets?

2010-02-21 Thread Dennis Kaarsemaker
On ma, 2010-02-15 at 18:22 -0800, ydjango wrote: > I have two query sets with two different where clause on same table > and same columns. Is it possible to have their union. > > I tried qryset = qryset1 + qryset2 - It gave me - "+ unsupported > argument" One possible way: queryset = yourmodel.o

Re: formatting results of search

2010-02-21 Thread Dennis Kaarsemaker
On wo, 2010-02-17 at 05:32 -0800, gintare wrote: > @@in *.html > @@using line {{ word|escape }} > > @@i am getting printed answer :(u'moi',) instead of moi. > @@I need only word moi (without any brakets, quatations) be visible in > a webpage. In this case you want word.0|escape values() alway

Re: have trouble with safe and linebreaks together

2010-02-21 Thread Benjamin
If you still want to give your users quite a bit of formatting power (other than just 'title' and 'body' fields), consider letting them use something like markdown, restructured test, or something similar. This way your application is safe from running arbitrary HTML, but your users get to make thi

Othogonal aspects to models

2010-02-21 Thread klaasvanschel...@gmail.com
Hi all, Maybe I'm asking the wrong questions, maybe I'm asking the impossible, maybe I need to do the hard thinking myseld. Anyway: here's my problem. We have a bunch of projects (about 4 big customers), some of which have significant overlap. The current approach is copy/paste, supported by tool

Djamgo cookies

2010-02-21 Thread theiklabs
I have a firewall that immediately expires cookies. I can log into amazon and other websites without issue and they don't modify my url? How can I fix this Sent from my Verizon Wireless BlackBerry -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Djamgo cookies

2010-02-21 Thread Dennis Kaarsemaker
On zo, 2010-02-21 at 23:51 +, theikl...@gmail.com wrote: > I have a firewall that immediately expires cookies. [...] How can I > fix this Get a better firewall. Firewalls shouldn't mess with cookies. -- Dennis K. The universe tends towards maximum irony. Don't push it. -- You received this

Re: Djamgo cookies

2010-02-21 Thread adamjamesdrew
This is a default install for a computer associates firewall. Any thoughts on why amazon would work with no url mods... Cookie domain ?? Expiration type Dennis Kaarsemaker wrote: > On zo, 2010-02-21 at 23:51 +, theikl...@gmail.com wrote: > > I have a firewall that immediately expires cookies.

Re: Othogonal aspects to models

2010-02-21 Thread Shawn Milochik
Check out James Bennett's DjangoCon 2008 talk on reusable apps. He goes into some detail on how he made django-registration in such a way that it wasn't necessary to require a specific model in order for it to work. I haven't implemented anything this reusable myself so I can't really give you m

Re: How to Create models with columns not corresponding to database.

2010-02-21 Thread arserangel
ho ho,studing from every one! tutorial! -- Original -- From: "Shawn Milochik"; Date: Sun, Feb 21, 2010 08:43 PM To: "django-users@googlegroups.com"; Subject: Re: How to Create models with columns not corresponding to database. >From your questi

Most Recent Distinct Results

2010-02-21 Thread max
Hi, I have a list of "news" matches for certain companies, ordered by the date they were found. I want to grab 5 results for each company up to 5 companies. I initially approached this problem by just grabbing a large amount of the newest results (LIMIT 100 or so) and then, through python, groupi

Use admin tools for "normal users" pages

2010-02-21 Thread sebsheep
Hello, I've just discovered Django and its amazing admin part management. Is it possible to use these tools in production ? I would like to realize a kind of wiki-organizer(nothing exceptionnal, just need to have a very specific tool), where each user can add events. I thought to use the admin mo

Overriding widget for forms.ModelMultipleChoiceField in ModelForm

2010-02-21 Thread Zodiak
Does anybody know how to make this? This variant: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets DOES NOT WORK for forms.ModelMultipleChoiceField -- You received this message because you are subscribed to the Google Groups "Django use

custom auth backend and ./manage.py test

2010-02-21 Thread Stephen Crosby
I'm working on a project that requires a custom auth backend which I've just written by subclassing contrib.auths.backends.ModelBackend and overriding the authenticate method so it takes a third parameter. It works nicely, but of course there are now lots of failed auth- related tests because of th

Re: Working with outside data sources

2010-02-21 Thread Michael Lissner
Thanks again for these replies. Very helpful indeed. Rishabh Manocha wrote on 02/18/2010 07:47 PM: > > > On Fri, Feb 19, 2010 at 11:23 AM, Michael Lissner > > wrote: > > Thanks for the reply. > > My teammate that writing the scrapers is a java guy, a

Re: Use admin tools for "normal users" pages

2010-02-21 Thread Timothy Kinney
You basically just need to copy the admin templates and views (see the django.contrib.admin directory) to your user templates and views (you can set where this directory is in settings.py, but it's often a directory called templates under your project or your app). Then it should be easy to look th

SAAS User and Auth situation.

2010-02-21 Thread orokusaki
I'm developing an SAAS which means that I will have Accounts and those Accounts will have Users. Each account's Users are completely orthogonal to the Users of another Account. When a user logs in, they'll supply an Account ID, a username, and a password so username only needs to be unique with reg

Job opportunity - Newcastle, NSW, Australia

2010-02-21 Thread Peter
Hi all Please see: http://tinyurl.com/djangojob for a job being advertised by NSW Rural Doctors Network in Newcastle, NSW, Australia. Thanks. Peter J Williams Information Manager NSW Rural Doctors Network Head Office Suite 19, Level 3 133 King Street Newcastle NSW 2300 Telephone: (02) 4924-800

django and its interactive shell on osx

2010-02-21 Thread Massimo Di Stefano
Hi All, I'm on osx 10.6.x (system python, django trunk, ipython from bazar repository) tring to run the django shell i have : MacBook-Pro-15-di-Massimo-Di-Stefano:geodjango sasha$ python manage.py shellTraceback (most recent call last): File "manage.py", line 11, in execute_manager(settin

Re: Generate random data for Django models

2010-02-21 Thread Timothy Kinney
Okay, I've got such a button and I have copied a template from admin to serve as a stand-in for it. I have created functions under ProvinceAdmin (in myapp\admin.py) that look like: ** code ** def ProvinceAdmin(admin.ModelAdmin): # other stuff def add_random_samurai(self, request):

Re: custom auth backend and ./manage.py test

2010-02-21 Thread Mike Dewhirst
On 22/02/2010 10:53am, Stephen Crosby wrote: I'm working on a project that requires a custom auth backend which I've just written by subclassing contrib.auths.backends.ModelBackend and overriding the authenticate method so it takes a third parameter. It works nicely, but of course there are now l

A Query question about Many-to-many relationships

2010-02-21 Thread Jason
Dear All, Model source code: from django.db import models class Publication(models.Model): title = models.CharField(max_length=30) class Article(models.Model): headline = models.CharField(max_length=100) publications = models.ManyToManyField(Publication) If