django not taking in consideration model fields declared in __init__

2010-09-07 Thread maroxe
Hi, When using Model class like this:

class MyModel(models.Model):
def __init__(self, *args, **kwargs):
self.myfield = models.Field()
super(MyModel, self).__init__(*args, **kwargs)
It doesn't take into consideration myfield(in the admin form, when
saving the object... )

But if i declare like that:

class MyModel(models.Model):
myfield = models.Field()
It works just fine.

Why?

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-tagging languages and multi fields

2010-09-07 Thread Lachlan Musicman
On Tue, Sep 7, 2010 at 16:39, Henrik Genssen wrote:

> Hi,
>
> has someone a solution for tags in more than one language for the same
> entry?
> I normally use transdb (1) to archive this on char or textfields. But what
> about tags in multi languages for one entry?
>
> Has someone managed to get more than one tag field for a model? e.g. for
> internal and external tagging of an entry...
>
>

I don't know about transdb, but I am using django tagging
http://code.google.com/p/django-tagging/ and ran into the same problem.

On a book model, I wanted a "tag" tag and a "genre" tag. Turns out you can
have more than one, but not in the way I expected.

The way Django tagging is written, tags can be tagged. So I just have the
one "tag" field on the book model, and then I tag some of the tags as
"genre".

Is that what you mean?

L.



> regards
> Hinnack
>
>
> (1) http://code.google.com/p/transdb/
>
> Henrik Genssen
>
> h...@miadi.net
> Tel. 0451/6195650
> Fax. 0451/6195655
>
> miadi GmbH
> Geschäftsführer: Henrik Genssen
> Sitz der Gesellschaft: Beckergrube 2, 23552 Lübeck
> Amtsgericht Lübeck HRB 10223, USt-IdNr DE
> Lieferungen und Leistungen erfolgen ausschließlich auf Grundlage unserer
> allgemeinen Geschäftsbedingungen
>
> --
> 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
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
These simple functions belong to a sub-class known as strictly dominating
functions, meaning that their output is always bigger than their inputs. A
striking fact, known as the complementation theorem, holds for all such
functions. It says there is always an infinite collection of inputs that
when fed into the function will produce a collection of outputs that is
precisely the non-inputs.
- http://bit.ly/d3Fsrw

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Does anyone have the completed and fully-working code from the Tutorial?

2010-09-07 Thread Lachlan Musicman
On Wed, Sep 8, 2010 at 04:27, Erskine  wrote:

> After much gnashing of teeth and having looked over the code dozens of
> times I finally realized I was missing one wretched little comma in
> the HttpResponseRedirect return argument.
>

heh. The archetypal "welcome to coding" bug headfsck. I still remember my
first. Damn they suck.


 On Sep 7, 1:26 pm, David De La Harpe Golden
>  wrote:
> > On 07/09/10 16:44, Erskine wrote:
> >
> > > I've spent a few days working through the First App tutorial, and have
> > > mostly got everything working, but I haven't been able to figure out
> > > why I'm getting an extra slash appended after 'polls' when clicking on
> > > the name of the poll
> > > The current URL, polls//, didn't match any of these.
> >
> > Probably you've got a typo in one of your templates, a bit
> > that generates the link to the poll i.e. somewhere you're supposed
> > to have some link like
> >
> > 
> >
> > ... but if the bit in {{ }} evaluated to nothing instead
> > of the id of a poll, you'd get "polls//", you see.
> > That could happen if you typed "pole.id" instead of "poll.id", say.
>
> --
> 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
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
These simple functions belong to a sub-class known as strictly dominating
functions, meaning that their output is always bigger than their inputs. A
striking fact, known as the complementation theorem, holds for all such
functions. It says there is always an infinite collection of inputs that
when fed into the function will produce a collection of outputs that is
precisely the non-inputs.
- http://bit.ly/d3Fsrw

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



New-by Model traps and other questions...

2010-09-07 Thread Lance F. Squire
Ok, I'm just getting back to a project I had to put on hold for a
while.

I recently read an article on problems new Django users fall into, and
I think I hit one.

The bottom of my 'Systems' model looks like this:

keyboard = models.CharField(max_length=80)
cart = models.CharField(max_length=80)
ram = models.CharField(max_length=40)
rom = models.CharField(max_length=40)
media = models.CharField(max_length=80)
options = models.CharField(max_length=120)
quick = models.TextField()
info = models.TextField()
system_pictures = models.ManyToManyField('Image')
public = models.BooleanField()

def __unicode__(self):
return self.name

def get_header_pic(self):
return
self.system_pictures.filter(image_category__name='Header_Pic')[0]

def get_header_logo(self):
return
self.system_pictures.filter(image_category__name='Header_Logo')[0]

The problem is that when using the admin to enter the data for the
Systems, I get a list of every pic in the 'Image' model to choose
from.

I can see this getting frustrating very fast.

I'm thinking that I can just use the fields in the 'Image' model to
find the appropriate pics, but don't know how to re-structure
'get_header_pic' to work with that. Or should I be doing something
different in the View or Template to access these pics?

Also, I added and 'Thumb' model when I added functionality I hadn't
originally though of. Unfortunately, it's almost an exact copy of the
"Image' model I made.

As seen here:

class Image(models.Model):
name = models.CharField(max_length=80)
slug = models.CharField(max_length=80)
location = models.URLField()
height = models.IntegerField()
width = models.IntegerField()
image_category = models.ForeignKey('ImageCat')
info = models.TextField()
primary = models.BooleanField()

def __unicode__(self):
return self.name

class Thumb(models.Model):
name = models.CharField(max_length=80)
slug = models.CharField(max_length=80)
location = models.URLField()
height = models.IntegerField()
width = models.IntegerField()
system = models.ForeignKey('System')
image_category = models.ForeignKey('ImageCat')
big = models.ForeignKey('Image')
primary = models.BooleanField()

def __unicode__(self):
return self.name

I'm thinking I should merge them by adding t_height, t_width and
t_location to the 'Image' model. Am I missing any downside to doing
this?

Lance

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: home page menu view variables cross every view?

2010-09-07 Thread Vasil Vangelovski
You can use your own template for flatpages, see
http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/?from=olddocs#flatpage-templates
Just make that menu a separate template and include it wherever you want. Of
course your flatpages template and your other templates can inherit from the
same base where the menu is included.

I  don't know what you mean by  "place
these variables ( db queries)"? Anyway if your menu is generated from a
database and it won't change often it's a good idea to wrap such template
code in a cache tag, especially if you make manny queries to generate that
menu.

On Tue, Sep 7, 2010 at 8:55 PM, Goran  wrote:

> I'm Django novice and I want to have some menu (top menu) which have
> some dynamically populated items. So inside home page view I have some
> variables to get these menu items. But because it's top menu I need it
> on every page on the site and i have about 20 views.  So I'm place
> these variables ( db queries) in every view on the site. It works
> except on the Flatpages because I can't find a way to extend Flatpage
> view with these variables. Now I have two questions:
>
> 1. How can I extend FlatPage view to get these menu variables on the
> flatpages.
> 2. Am I miss something? What's happen with D.R.Y. if I need to place
> the same variables on the every view and repeat myself 20 times?
>
> Any advice?
> Thanks
>
> --
> 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
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: home page menu view variables cross every view?

2010-09-07 Thread Thomas Rega
On Tue, Sep 7, 2010 at 8:55 PM, Goran  wrote:
> I'm Django novice and I want to have some menu (top menu) which have
> some dynamically populated items. So inside home page view I have some
> variables to get these menu items. But because it's top menu I need it
> on every page on the site and i have about 20 views.  So I'm place
> these variables ( db queries) in every view on the site. It works
> except on the Flatpages because I can't find a way to extend Flatpage
> view with these variables. Now I have two questions:
>
> 1. How can I extend FlatPage view to get these menu variables on the
> flatpages.
> 2. Am I miss something? What's happen with D.R.Y. if I need to place
> the same variables on the every view and repeat myself 20 times?
>
> Any advice?
> Thanks


Hi,

whats about extending? for example base.html?

Could this be a way to solve your problem?

http://stackoverflow.com/questions/671369/django-specifying-a-base-template-by-directory

A live example and pretty cool explanation can be seen in this screencast(s):
http://showmedo.com/videotutorials/series?name=PPN7NA155
(The mentioned project is not available anymore but the principles are pretty
clear explained. I think extending is shown in episode 3.)

good luck
TR

>
> --
> 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.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
--- http://thoreg.org ---

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to add a FileField to a dynamically created form

2010-09-07 Thread ranjan.kumar
Hi,
How can we dynamically add a fileField to the dynamic form. I tried
doing that using the following code but it is throwing errors.


from django import forms

class QuestionsForm(forms.Form):
def __init__(self, questions,  *args, **kwargs):
super(QuestionsForm, self).__init__(*args, **kwargs)
for question in questions:
if question.answer_type == 'textbox':
self.fields['question_%d' % question.id] =
forms.CharField(widget = forms.Textarea( attrs={'rows':5, 'cols':60}))
elif question.answer_type == 'file':
self.fields['question_%d' % question.id] =
forms.FileField(upload_to='some_dir/')

The error message that i'm getting is: init() got an unexpected
keyword argument ‘upload_to’

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: python manage.py runserver - can't see error stack traces when an Ajax handler throws an exception

2010-09-07 Thread elijah rutschman
On Tue, Sep 7, 2010 at 5:10 PM, Phlip  wrote:
>
> Djangoists:
>
> Under runserver, when I click on an Ajaxy thing on my web site, and
> its handler throws an exception...
>
> ...the console says nothing (in DEBUG = True mode)
>
> ...and Django renders a beautiful HTML exception report
>
> ...and sends this over the wire into my browser
>
> ...who then throws it away because it's not Ajax
>
> ...and I must dig it out with a developer toolkit tool
>
> ...and paste it into a file yo.html
>
> ...and render this in a browser
>
> ...to see the actual error.
>
> I'm probably missing some configuration option, subsidiary to DEBUG
> mode. (v1.2, BTW)
>
> How do I get Ajax errors to print a simple exception trace to STDOUT,
> instead of going through all that baloney?

Use middleware that has a 'process_exception' method defined.
http://docs.djangoproject.com/en/dev/topics/http/middleware/#process_exception

This snippet is simple and does the trick:
http://djangosnippets.org/snippets/420/

-Elijah

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Translating Google Chart API parameters to Django

2010-09-07 Thread Alexandre González
I'm using this snippet:

http://djangosnippets.org/snippets/1494/

I hope that this works for you!

On Mon, Sep 6, 2010 at 13:30, tbb  wrote:

> Is there a table that translates the Google Chart API parameters to
> Django tags?
>
> The parameters for creating a chart using the Google Charts API look
> like this:
> cht=bvg
> chs=250x150
> chd=s:Monkeys
> chxt=x,y
> chxs=0,ff,12,0,lt
> 1,ff,10,1,lt
>
> Whereas the Django parameters look like this:
> {% chart  Line fohmnytenefohmnytene  encoding=simple  %}
>{% size 200 100  %}
>{% axes type xy  %}
>{% axes label April May June  %}
>{% axes label None  50+Kb  %}
> {% endchart %}
>
> How could I recreate the first example in Django?
>
> --
> 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
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



python manage.py runserver - can't see error stack traces when an Ajax handler throws an exception

2010-09-07 Thread Phlip
Djangoists:

Under runserver, when I click on an Ajaxy thing on my web site, and
its handler throws an exception...

...the console says nothing (in DEBUG = True mode)

...and Django renders a beautiful HTML exception report

...and sends this over the wire into my browser

...who then throws it away because it's not Ajax

...and I must dig it out with a developer toolkit tool

...and paste it into a file yo.html

...and render this in a browser

...to see the actual error.

I'm probably missing some configuration option, subsidiary to DEBUG
mode. (v1.2, BTW)

How do I get Ajax errors to print a simple exception trace to STDOUT,
instead of going through all that baloney?

--
  Phlip
  http://c2.com/cgi/wiki?SamuraiPrinciple <-- re: django.db!

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django with PyPy JIT?

2010-09-07 Thread Andy
Thanks Alex,

Is there any instructions on how to set up django with PyPy you could
point me to?

Andy


On Sep 5, 7:50 pm, Alex_Gaynor  wrote:
> On Sep 5, 4:40 pm, Andy  wrote:
>
> > Anyone tried running Django with PyPy JIT?
>
> > What are the steps to set it up? Is it stable?
>
> > PyPy benchmark shows almost 3X speed up of Django and they also said
> > it would reduce memory consumption. I'm interested in trying it out.
> > Just want to learn about anyone's experience with running Django on
> > PyPy.
>
> > Are there any pitfalls?
>
> > Thanks.
>
> Hi Andy,
>
> I haven't deployed Django under PyPy ever, however I have been working
> to ensure they work together.  If you take a look at the videos from
> here:http://morepypy.blogspot.com/2010/08/europython-2010-videos-available...
> you can see some of the stuff that's been done with it.  The one major
> pitfall is that there are no c-extensions, so you can't use something
> like psycopg2.
>
> Alex

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Strange unit test / OAuth Issue

2010-09-07 Thread Bill Freeman
Why not check which version of oauth you have in each place?

Even if there isn't a usable version indicator in the library, you could
generate a file containing the chacksums of all the py files, sort it, and
compare it.

On Tue, Sep 7, 2010 at 4:46 AM, Chris  wrote:
> So I wrote some django unit tests for an app that uses OAuth and I ran
> into this strange issue when attempting to set my verifier:
>
> On my local dev machine it likes me to set my verifier like so:
> token.set_verifier(verifier)
>
> On my production machine it like me to set my verifier like so:
> oauth_request = oauth.OAuthRequest.from_consumer_and_token(
>    self.apicall.consumer,
>    token=token,
>    verifier=verifier,
>    http_url=self.apicall.access_token_url
> )
>
> Both my dev machine and production machine can't agree on which way
> they would like to set the verifier. If I perform both methods, then
> both dev and production seem to be happy!  Why is this? Could I have a
> slightly different version of oauth on both the machines?
>
> Here is the full snippet of code that sets the verifier and makes the
> access token request:
>
>        verifier = "zNd4KsqnL9"
>       # Dev likes it this way
>        token.set_verifier(verifier)
>
>        oauth_request = oauth.OAuthRequest.from_consumer_and_token(
>            self.apicall.consumer,
>            token=token,
>            # prod likes it this way
>            verifier=verifier,
>            http_url=self.apicall.access_token_url
>        )
>        oauth_request.sign_request(self.apicall.signature_method,
>            self.apicall.consumer, token
>        )
>        params = oauth_request.parameters
>        response = self.client.get(self.apicall.access_token_url,
> params)
>
> --
> 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.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-twitter-oauth connection refused

2010-09-07 Thread Bill Freeman
I apparently have a different vintage of httplib in my 2.6, since the
  raise CannotSendRequest()
is on line 778.

It seems to mean reuse of an HTTPConnection object that isn't idle.

Maybe a threading problem?  Does this happen with the development server?
pdb is your friend (standard advice).

Bill

On Mon, Sep 6, 2010 at 12:39 AM, ashy  wrote:
> Hi All,
>
> Now I am getting 'Cannot send request' exception.
> Exception Location:  /usr/lib/python2.6/httplib.py in putrequest, line
> 802
> Some problem with httplib. Any ideas?
>
> thanks
>    ashwin
>
> On Sep 4, 1:16 am, Bill Freeman  wrote:
>> No.  I'm not actually using twitter anywhere.  I just remember the
>> email saying that the API changed on Tuesday, so I'm not surprised if
>> things that worked before are broken now.
>>
>> On Fri, Sep 3, 2010 at 10:26 AM, ashwin morey  wrote:
>> > Hi Bill,
>>
>> > Did you try using django-twitter-oauth
>> >http://github.com/henriklied/django-twitter-oauth#readme?
>> > I got the error while using this app.
>>
>> > thanks
>> >     ashy
>>
>> > On Fri, Sep 3, 2010 at 7:46 PM, Bill Freeman  wrote:
>>
>> >> There was an email from twitter to it's users, yesterday or the day
>> >> before,
>> >> saying that they've changed their auth API.  I think it was a change to
>> >> requiring OAUTH, but you may want to check whether port or SSL changes
>> >> have occurred.
>>
>> >> On Fri, Sep 3, 2010 at 10:08 AM, ashy  wrote:
>> >> > Hi All,
>>
>> >> > I am using django-twitter-oauth app in my project, but I am getting
>> >> > the following error while trying to connect to twitter.com.
>>
>> >> > Exception Value:        (111, 'Connectionrefused')
>> >> > Exception Location:     /usr/lib/python2.6/socket.py in
>> >> > create_connection, line 514
>>
>> >> > token = get_unauthorised_request_token(CONSUMER,CONNECTION)
>> >> > resp = fetch_response(oauth_request,connection)
>> >> >connection.request(oauth_request.http_method, url)
>>
>> >> > Also, Iam working behind proxy. How can I use oauth library behind
>> >> > proxy? Any ideas.
>>
>> >> > thanks
>> >> >    ashy
>>
>> >> > --
>> >> > 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.
>> >> > For more options, visit this group at
>> >> >http://groups.google.com/group/django-users?hl=en.
>>
>> >> --
>> >> 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.
>> >> For more options, visit this group at
>> >>http://groups.google.com/group/django-users?hl=en.
>>
>> > --
>> > 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.
>> > For more options, visit this group at
>> >http://groups.google.com/group/django-users?hl=en.
>
> --
> 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.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Speed of django dev server start up

2010-09-07 Thread felix
Does anybody know of any tricks or patches for working with the
development server that could speed up its startup time ?

Currently if your site is large and has many modules, models, admins,
forms etc then django development time slows down dramatically.

I'm thinking that the models don't need to be validated every time, an
option could avoid doing that.  Admin site should/could be loaded
lazily.  Disable all admins in code that aren't being used.  I'm
considering separating the admin entirely to a separate site/domain.


any tricks out there ?

-cx

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



home page menu view variables cross every view?

2010-09-07 Thread Goran
I'm Django novice and I want to have some menu (top menu) which have
some dynamically populated items. So inside home page view I have some
variables to get these menu items. But because it's top menu I need it
on every page on the site and i have about 20 views.  So I'm place
these variables ( db queries) in every view on the site. It works
except on the Flatpages because I can't find a way to extend Flatpage
view with these variables. Now I have two questions:

1. How can I extend FlatPage view to get these menu variables on the
flatpages.
2. Am I miss something? What's happen with D.R.Y. if I need to place
the same variables on the every view and repeat myself 20 times?

Any advice?
Thanks

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Does anyone have the completed and fully-working code from the Tutorial?

2010-09-07 Thread Erskine
After much gnashing of teeth and having looked over the code dozens of
times I finally realized I was missing one wretched little comma in
the HttpResponseRedirect return argument.

On Sep 7, 1:26 pm, David De La Harpe Golden
 wrote:
> On 07/09/10 16:44, Erskine wrote:
>
> > I've spent a few days working through the First App tutorial, and have
> > mostly got everything working, but I haven't been able to figure out
> > why I'm getting an extra slash appended after 'polls' when clicking on
> > the name of the poll
> > The current URL, polls//, didn't match any of these.
>
> Probably you've got a typo in one of your templates, a bit
> that generates the link to the poll i.e. somewhere you're supposed
> to have some link like
>
> 
>
> ... but if the bit in {{ }} evaluated to nothing instead
> of the id of a poll, you'd get "polls//", you see.
> That could happen if you typed "pole.id" instead of "poll.id", say.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Automatically loading data into Django

2010-09-07 Thread Duane Hilton
Thanks for the response. I think that is exactly what I'm looking for.
But, being a newb, this raises new questions that I will spare the
group. Could you point me toward a book or tutorial that would show me
how to do that?

Thanks.

On Tue, Sep 7, 2010 at 10:23 AM, Shawn Milochik  wrote:
> It doesn't seem like converting your data into fixtures will provide
> any advantage. If it's pipe-delimited, then just write a Python script
> imports the CSV module (which can handle other delimiters) and your
> model(s).
>
> Use it to read the data and convert it to dictionaries, then create
> instances of your models, populate them, and save them.
>
> Shawn
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Please wait page trouble

2010-09-07 Thread Alec Shaner
You need to include the jquery library script in your html page if you're
calling getJSON as in the previous emails (and note that getJSON isn't
necessarily the function you want - jquery provides many options for doing
AJAX). Either download it, or use one of the public repositories:

http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery

In fact, just view the html source code for the link just referenced -
you'll see how jquery is included:

http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js
http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js>">

Then I'd recommend one of the tutorials, e.g.,:

http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery

The tutorials should serve as live examples.

On Tue, Sep 7, 2010 at 10:31 AM, Bradley Hintze  wrote:

> It seems as if this is the only solution but after a week of trying to
> implement it in a variety of ways it won't work. is there something I
> need to download (jquery)? More helpful would be a real HTML page as
> an example or a live example on the web. I am sorry for the trouble
> but I'd like to understand this and get it working.
>
> On Tue, Aug 31, 2010 at 7:37 PM, Alec Shaner 
> wrote:
> > $.getJSON should be embedded in your initial Page Wait response page. The
> > first argument isn't a view, rather a URL. So you might want to use the
> > django url template tag, e.g.,
> > $.getJSON('{% url whatever.run_DHM %}', ...)
> > The second argument is a callback function. The browser stores the
> callback
> > and subsequently calls it when the url requested returns a response. It
> also
> > might be confusing because the function is defined inline (anonymous),
> which
> > is a frequent shortcut used in javascript. But anyway, when the callback
> > function executes he just put console.log(result.data) as way to see what
> > gets returned.
> >  You say you want to send the user to another page with the results, but
> you
> > could return a rendered chunk of html code and replace the Please Wait
> > message using jquery to mainupulate the DOM (jquery documentation has
> > tutorials). Or if you want to redirect to a new page you could store the
> > calculation results in the session and redirect to a view that pulls from
> > that same session data (or use memcached). So maybe instead of
> > console.log(result.data), you could
> > use window.location="/some/url/to/show/calculations/";
> > His example returns a HttpResponse just to illustrate the concept of how
> to
> > return JSON data. You don't have to return JSON, but it's a good method
> if
> > you want to return structured data. In the above example of a redirect
> you
> > could just return anything I suppose, i.e., just an 'OK'.
> >
> > On Tue, Aug 31, 2010 at 5:11 PM, Bradley Hintze
> >  wrote:
> >>
> >> Ok, I'll try to elaborate. again java is foreign to me although I've
> >> spent all day trying to learn some.
> >>  Here's the code:
> >>
> >> def please_wait(request):
> >>   # ... setup context or something
> >>   return render_to_response("please_wait.html")
> >>
> >> def run_DHM(request)
> >>   # ... perform calculations and collect the result in a dict
> >>   data = {"result": something}
> >>   return HttpResponse(json.dumps(data), mimetype="application/json")
> >>
> >>
> >> # using jquery in your html
> >> 
> >> $.getJSON("/run_DHM/", function(data) {
> >>   // do something with result
> >>   console.log(data.result);
> >> });
> >> 
> >>
> >> def run_DHM(request) is straight forward then it falls apart.
> >>
> >> $.getJSON("/run_DHM/", function(data) {
> >>   // do something with result
> >>   console.log(data.result);
> >> });
> >>
> >> I presume that '$.getJSON("/run_DHM/", function(data)' somehow runs
> >> the run_DHM function? How can it even find the function since it lives
> >> in view.py? '// do something with result' I want to send another
> >> page to the client with the results but do I do this here? If not,
> >> what do I do here? What does 'console.log(data.result);' do? Why does
> >> def run_DHM(request) return a HttpResponse? I have a template I want
> >> it to return so shouldn't I use render_to_response? Obviously, I am
> >> not getting how the javascript works so I have no idea how to set this
> >> up. I was hoping there was a pythonic solution :).
> >>
> >> I hope this explains my utter confusion sufficiently.
> >>
> >> Bradley
> >>
> >>
> >
> > --
> > 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
> .
> > For more options, visit this group at
> > 

Re: Does anyone have the completed and fully-working code from the Tutorial?

2010-09-07 Thread David De La Harpe Golden
On 07/09/10 16:44, Erskine wrote:
> I've spent a few days working through the First App tutorial, and have
> mostly got everything working, but I haven't been able to figure out
> why I'm getting an extra slash appended after 'polls' when clicking on
> the name of the poll 

> The current URL, polls//, didn't match any of these.
> 

Probably you've got a typo in one of your templates, a bit
that generates the link to the poll i.e. somewhere you're supposed
to have some link like



... but if the bit in {{ }} evaluated to nothing instead
of the id of a poll, you'd get "polls//", you see.
That could happen if you typed "pole.id" instead of "poll.id", say.







-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Automatically loading data into Django

2010-09-07 Thread Shawn Milochik
It doesn't seem like converting your data into fixtures will provide
any advantage. If it's pipe-delimited, then just write a Python script
imports the CSV module (which can handle other delimiters) and your
model(s).

Use it to read the data and convert it to dictionaries, then create
instances of your models, populate them, and save them.

Shawn

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Aggregate on part of a date field?

2010-09-07 Thread Don
I need to create a query that aggregates values by the year of a date
field. I have not been able to discover a way to do this yet, perhaps
someone can help. I can issue the following raw query, which gives the
results I want:

cursor.execute("""SELECT year(oac_date) as year, month(oac_date) as
month, sum(oac_actualconsumption) as consumption
 FROM actualconsumption
WHERE oac_object = %s AND oac_commodity = %s AND
year(oac_date) = %s
GROUP BY year(oac_date), month(oac_date)
ORDER BY month(oac_date)""", [object_id, commodity, year])

Where oac_object is the pk for the table.

This summarizes the oac_actualconsumption by year. Does anyone have an
idea how to do this without resorting to a raw query? I have not been
able to get the aggregates to work over parts of a date field in the
database, only on the whole field.

Thanks!

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Automatically loading data into Django

2010-09-07 Thread Duane Hilton
Hello,

I'm trying to automatically update a Django project using json
fixtures. ... There is a pipe delimited file that is automatically
updated. I would like to save the data from that file into a Django
project. The way I have been approaching this is to convert the file
into json fixtures and use manage.py loaddata to get the data into the
Django project. Is there a better way?

Also, I would like to be able to show when a record was last updated.
I know this is easy to do if you are using the admin site to input
information (as shown in Practical Django Projects), but I haven't
seen a way to do it using loaddata. How do you show when a record was
updated if you're not using the admin site?

Thanks in advance for any responses.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Does anyone have the completed and fully-working code from the Tutorial?

2010-09-07 Thread Erskine
I've spent a few days working through the First App tutorial, and have
mostly got everything working, but I haven't been able to figure out
why I'm getting an extra slash appended after 'polls' when clicking on
the name of the poll http://127.0.0.1:8000/polls//. This gives me an
error page with:

Using the URLconf defined in mysite.urls, Django tried these URL
patterns, in this order:

1.^polls/ ^$
2.^polls/ ^(?P\d+)/$
3.^polls/ ^(?P\d+)/results/$
4.^polls/ ^(?P\d+)/vote/$
5.^polls/ ^admin/
6.^admin/
The current URL, polls//, didn't match any of these.


I also get this if I go manually to one of the polls pages and click
the 'Vote' button. I've gone through all the code many times and can't
see anything I've done wrong. Admittedly some of the documentation is
hard to follow, but I think I've got everything correct. The three
templates in the end should be called 'poll_detail.html',
'poll_list.html' and results.html, if I understood everything
properly.

Thanks

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Using group by aggregation (values().annotate()) on fields from joined table

2010-09-07 Thread Beres Botond
Hi Patrick,

It *does* support this as far as I know. I've tried/used similar
queries and it works ok, although ofc not with your models.
Please post your model definitions for CitlData and Installation, to
see if there's any issue there.
Also what version of Django are you using?

Best Regards,

Béres Botond

On Sep 7, 2:12 pm, patrick  wrote:
>
> Does the values().annotate() functionality not support grouping by
> joined table fields or am I missing something here?
>
> Any help much appreciated!
>
> Thanks,
> Patrick

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



RE: Re: django-tagging languages and multi fields

2010-09-07 Thread Henrik Genssen
Hi Béres,

no, that will not work for me. I need the possibility to have diffenrent (e.g. 
empty)
tags for every language...

regards

Henrik

>reply to message:
>date: 07.09.2010 09:04:38
>from: "Beres Botond" 
>to: "Django users" 
>subject: Re: django-tagging languages and multi fields
>
>Hi Henrik,
>
>What are your exact requirements? Is it sufficient if you could simply
>translate all your tag instances (in every language you have basically
>the same tags for the same entry, except translated)?
>
>Or you need to be able to have possibly completely different tags for
>the same model instance in different languages?
>
>Regards,
>
>Béres Botond
>
>
>On Sep 7, 9:39 am, "Henrik Genssen"  wrote:
>> Hi,
>>
>> has someone a solution for tags in more than one language for the same entry?
>> I normally use transdb (1) to archive this on char or textfields. But what 
>> about tags in multi languages for one entry?
>>
>> Has someone managed to get more than one tag field for a model? e.g. for 
>> internal and external tagging of an entry...
>>
>> regards
>> Hinnack
>>
>> (1)http://code.google.com/p/transdb/
>>
>> Henrik Genssen
>>
>> h...@miadi.net
>> Tel. 0451/6195650
>> Fax. 0451/6195655
>>
>> miadi GmbH
>> Gesch ftsf hrer: Henrik Genssen
>> Sitz der Gesellschaft: Beckergrube 2, 23552 L beck
>> Amtsgericht L beck HRB 10223, USt-IdNr DE
>> Lieferungen und Leistungen erfolgen ausschlie lich auf Grundlage unserer 
>> allgemeinen Gesch ftsbedingungen
>
>-- 
>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.
>For more options, visit this group at 
>http://groups.google.com/group/django-users?hl=en.
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Advice needed on bundling applications

2010-09-07 Thread Preston Holmes


On Sep 7, 1:45 am, Benedict Verheyen 
wrote:
> Hi,
>
> i've written a calltracking application for my company and other apps will 
> follow soon.
> Now, i would want a central way to access them and to assign rights on who 
> can see
> and run what application.
> The dashboard or access panel will be very simple: icons that link to the 
> application and based
> on the user, some apps will not be visible.
>
> I'm not sure as to what is the better approach.
> i'm thinking of making a new project "dashboard" where i have a simple
> model containing info like app name, icon, position on the dashboard and so 
> on.
> Easy enough.
>
> However, in my calltracking i have all the logic of usermanagement (login, 
> logout).
> Do i copy this to my dashboard and remove it from the calltracking app so you
> always have to login via the dashboard?
> Or do i just copy it to the dashboard?
>
> Another possibility is to make the dashboard the project and the calltracking 
> an app in that project?
> Is it possible to both use them as projects but still have one way to login 
> so that if a user
> is logged in on the dashboard, he/she is automatically logged in when 
> accessing the
> calltracking?

If you want user auth - then all your apps should be in one project -
such that your company == your project

The alternative is to use some other auth backend, such as LDAP - then
each project can reference that one auth directory.

-Preston

>
> Thanks for any insights,
> Benedict

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Advice needed on bundling applications

2010-09-07 Thread joconnell
Hi Benedict,

>From what I have observed, if you are using django.contrib.auth for
your login/logout feature then you should be able to login once from
whichever app and then all subsequent requests from that browser
(unless you clear the cache/delete cookies) will be considered to have
been made from an authenticated user. i.e.
request.user.is_authenticated() will return True

That's as far as I have noticed anyway.

John

On Sep 7, 9:45 am, Benedict Verheyen 
wrote:
> Hi,
>
> i've written a calltracking application for my company and other apps will 
> follow soon.
> Now, i would want a central way to access them and to assign rights on who 
> can see
> and run what application.
> The dashboard or access panel will be very simple: icons that link to the 
> application and based
> on the user, some apps will not be visible.
>
> I'm not sure as to what is the better approach.
> i'm thinking of making a new project "dashboard" where i have a simple
> model containing info like app name, icon, position on the dashboard and so 
> on.
> Easy enough.
>
> However, in my calltracking i have all the logic of usermanagement (login, 
> logout).
> Do i copy this to my dashboard and remove it from the calltracking app so you
> always have to login via the dashboard?
> Or do i just copy it to the dashboard?
>
> Another possibility is to make the dashboard the project and the calltracking 
> an app in that project?
> Is it possible to both use them as projects but still have one way to login 
> so that if a user
> is logged in on the dashboard, he/she is automatically logged in when 
> accessing the
> calltracking?
>
> Thanks for any insights,
> Benedict

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: mod_wsgi, apache, windows XP

2010-09-07 Thread Margie Roswell
my settings.py on slicehost is publicly readable. Is that just a
permissions issue?

No, it has same permissions. as another server where the settings.py
can't be downloaded...

Of course, we don't want people to see the database password.

How is this usually resolved?

Margie


On Mon, Sep 6, 2010 at 4:50 AM, Graham Dumpleton
 wrote:
> You can do that with mod_wsgi as well. Go to the mod_wsgi site and
> read the ConfigurationGuidelines page on the wiki.
>
> Sorry, can't paste link right now.
>
> Graham
>
> On Sep 6, 4:27 pm, Elim Qiu  wrote:
>> I followed a installation instruction and got
>> Apache/2.2.15 (Win32) SVN/1.6.12 mod_wsgi/3.3 Python/2.7 PHP/5.2.5 DAV/2
>> installed OK. Meaning that
>> I inserted the following lines to my httpd.conf:
>>
>> LoadModule wsgi_module modules/mod_wsgi.so
>> WSGIScriptAlias /wsgi "F:/Apache/appwsgi/wsgi_handler.py"
>>
>> #test the above byhttp://localhost/wsgi
>>
>> 
>> AllowOverride None
>> Options None
>> Order deny,allow
>> Allow from all
>> 
>>
>> ===
>> With the wsgi_handler.py content:
>>
>> def application(environ, start_response):
>> status = '200 OK'
>> output = 'Hello World!'
>>  response_headers = [('Content-type', 'text/plain'),('Content-Length',
>> str(len(output)))]
>> start_response(status,response_headers)
>>  return [output]
>>
>> ===
>> Then enter the url  http://localhost/wsgi  in the browser to get
>>
>> Hello World!
>>
>> ===
>>
>> So my wod_wsgi worked fine. But why python is so special compare with perl?
>>
>> With perl (I'm not saying it's nicer), I need only specify the script
>> alis to cgi-bin dir and then I can run many perl scripts installed in
>> cgi-bin. But with python and mod_wsgi, My WSGIScriptAlias only points
>> to a single python script?
>>
>> Sorry I'm just so new to this.  There must be something  I don't know but 
>> cool
>
> --
> 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.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Margie
--
http://www.BaltimoreUrbanAg.org
http://www.Real-Food-Farm.org
http://www.FriendlyCoffeehouse.org
http://www.packtpub.com/drupal-5-views-recipes/book

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Using group by aggregation (values().annotate()) on fields from joined table

2010-09-07 Thread patrick
Hi,

I am trying to sum a field from a joined table and group by another
field from that joined table. Installation is the table I am querying
and CitlData is the table I am joining in.

This is the code:
installations =
Installation.objects.values('citldata__year').annotate(Sum('citldata__emissions'),Sum('citldata__allocations'))

I am getting the following error:
---
FieldErrorTraceback (most recent call
last)

/Users/pc/Documents/Work/sandbag/sandbag_svn/sandbag/sandbag/ in ()

/sw/lib/python2.6/site-packages/django/db/models/query.pyc in
values(self, *fields)
502
503 def values(self, *fields):
--> 504 return self._clone(klass=ValuesQuerySet, setup=True,
_fields=fields)
505
506 def values_list(self, *fields, **kwargs):

/sw/lib/python2.6/site-packages/django/db/models/query.pyc in
_clone(self, klass, setup, **kwargs)
747 c.__dict__.update(kwargs)
748 if setup and hasattr(c, '_setup_query'):
--> 749 c._setup_query()
750 return c
751

/sw/lib/python2.6/site-packages/django/db/models/query.pyc in
_setup_query(self)
870 if self.extra_names is not None:
871 self.query.set_extra_mask(self.extra_names)
--> 872 self.query.add_fields(self.field_names, False)
873 if self.aggregate_names is not None:
874
self.query.set_aggregate_mask(self.aggregate_names)

/sw/lib/python2.6/site-packages/django/db/models/sql/query.pyc in
add_fields(self, field_names, allow_m2m)
   1509 self.select_fields.append(field)
   1510 except MultiJoin:
-> 1511 raise FieldError("Invalid field name: '%s'" %
name)
   1512 except FieldError:
   1513 names = opts.get_all_field_names() +
self.extra.keys() + self.aggregate_select.keys()

FieldError: Invalid field name: 'citldata__year'

However, if I filter Installation by a field from CitlData (i.e.,
installations =
Installation.objects.filter(citldata__year__exact=2009)) it works
fine. Also, if I annotate without the group by / values() function it
also works fine (i.e., installations =
Installation.objects.annotate(Sum('citldata__emissions'),Sum('citldata__allocations'))
 )

Does the values().annotate() functionality not support grouping by
joined table fields or am I missing something here?

Any help much appreciated!

Thanks,
Patrick

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



File storage

2010-09-07 Thread Dave
Hello,

I am doing a project in djagno and I stucked in working with files. I
am realy confused about, how it is described in django documentation
and I did not find a solution in it that would suit my case. So
basically what I want to do - I want to have a storage for some
certain files in my project separate from my directory for static
files e.g {{ project path}}/static/ directory for static files and
{{ project path }}/files/ for some specail files. How can I do that?

At first I have a file stored at {{ project path }}/files/temp/ and
when a particular model or form object is saved I want to move that
file to {{project path}}/files/stable/ (so it will be no longer in
temp dir) and rename file to "stable". I want to have only a one file
in stable dir, so when I moved there another file the old file will be
overwriten (now if I do it, django will create stable_1 and so on,
when I will try to save file with name that already exists).

I was trying to do it a cleaner way - to override a FileField save
method or override FileStorage class of that field, but I was unable
to find in docs a solution that will fit my speciffiaction precisely
as I want it. Maybe I will have to use os.system, what do you think? I
am kind of a newbie to django so I will appreciate any answer, thanks.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Please wait page trouble

2010-09-07 Thread Bradley Hintze
It seems as if this is the only solution but after a week of trying to
implement it in a variety of ways it won't work. is there something I
need to download (jquery)? More helpful would be a real HTML page as
an example or a live example on the web. I am sorry for the trouble
but I'd like to understand this and get it working.

On Tue, Aug 31, 2010 at 7:37 PM, Alec Shaner  wrote:
> $.getJSON should be embedded in your initial Page Wait response page. The
> first argument isn't a view, rather a URL. So you might want to use the
> django url template tag, e.g.,
> $.getJSON('{% url whatever.run_DHM %}', ...)
> The second argument is a callback function. The browser stores the callback
> and subsequently calls it when the url requested returns a response. It also
> might be confusing because the function is defined inline (anonymous), which
> is a frequent shortcut used in javascript. But anyway, when the callback
> function executes he just put console.log(result.data) as way to see what
> gets returned.
>  You say you want to send the user to another page with the results, but you
> could return a rendered chunk of html code and replace the Please Wait
> message using jquery to mainupulate the DOM (jquery documentation has
> tutorials). Or if you want to redirect to a new page you could store the
> calculation results in the session and redirect to a view that pulls from
> that same session data (or use memcached). So maybe instead of
> console.log(result.data), you could
> use window.location="/some/url/to/show/calculations/";
> His example returns a HttpResponse just to illustrate the concept of how to
> return JSON data. You don't have to return JSON, but it's a good method if
> you want to return structured data. In the above example of a redirect you
> could just return anything I suppose, i.e., just an 'OK'.
>
> On Tue, Aug 31, 2010 at 5:11 PM, Bradley Hintze
>  wrote:
>>
>> Ok, I'll try to elaborate. again java is foreign to me although I've
>> spent all day trying to learn some.
>>  Here's the code:
>>
>> def please_wait(request):
>>   # ... setup context or something
>>   return render_to_response("please_wait.html")
>>
>> def run_DHM(request)
>>   # ... perform calculations and collect the result in a dict
>>   data = {"result": something}
>>   return HttpResponse(json.dumps(data), mimetype="application/json")
>>
>>
>> # using jquery in your html
>> 
>> $.getJSON("/run_DHM/", function(data) {
>>   // do something with result
>>   console.log(data.result);
>> });
>> 
>>
>> def run_DHM(request) is straight forward then it falls apart.
>>
>> $.getJSON("/run_DHM/", function(data) {
>>   // do something with result
>>   console.log(data.result);
>> });
>>
>> I presume that '$.getJSON("/run_DHM/", function(data)' somehow runs
>> the run_DHM function? How can it even find the function since it lives
>> in view.py? '// do something with result' I want to send another
>> page to the client with the results but do I do this here? If not,
>> what do I do here? What does 'console.log(data.result);' do? Why does
>> def run_DHM(request) return a HttpResponse? I have a template I want
>> it to return so shouldn't I use render_to_response? Obviously, I am
>> not getting how the javascript works so I have no idea how to set this
>> up. I was hoping there was a pythonic solution :).
>>
>> I hope this explains my utter confusion sufficiently.
>>
>> Bradley
>>
>>
>
> --
> 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.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-tagging languages and multi fields

2010-09-07 Thread Beres Botond
Hi Henrik,

What are your exact requirements? Is it sufficient if you could simply
translate all your tag instances (in every language you have basically
the same tags for the same entry, except translated)?

Or you need to be able to have possibly completely different tags for
the same model instance in different languages?

Regards,

Béres Botond


On Sep 7, 9:39 am, "Henrik Genssen"  wrote:
> Hi,
>
> has someone a solution for tags in more than one language for the same entry?
> I normally use transdb (1) to archive this on char or textfields. But what 
> about tags in multi languages for one entry?
>
> Has someone managed to get more than one tag field for a model? e.g. for 
> internal and external tagging of an entry...
>
> regards
> Hinnack
>
> (1)http://code.google.com/p/transdb/
>
> Henrik Genssen
>
> h...@miadi.net
> Tel. 0451/6195650
> Fax. 0451/6195655
>
> miadi GmbH
> Gesch ftsf hrer: Henrik Genssen
> Sitz der Gesellschaft: Beckergrube 2, 23552 L beck
> Amtsgericht L beck HRB 10223, USt-IdNr DE
> Lieferungen und Leistungen erfolgen ausschlie lich auf Grundlage unserer 
> allgemeinen Gesch ftsbedingungen

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django model per table vs model per select

2010-09-07 Thread bruno desthuilliers

On 7 sep, 15:17, Lukáš  wrote:
> Hey,
>
> I am working with Django for a while and now that my "tree" and whole
> DB is filled with data (note: existing database), I was wondering if
> the "one model per table" is really better at this point than "one
> model per select".

I don't have the slightest clue about what "one model per select" is
supposed to mean... But anyway: a Django "model" class IS a
representation of a SQL table / row - so I fail to see how you could
avoid having a one-to-one mapping between models and tables (abstract
models and inheritance issues set aside).


> I have got one table - objtree. This is the place where I have all
> nodes (brands, categories, tags, etc.) stored.  As you can imagine it
> is heavily used in my administration. Today I had to add another
> foreign key for another table, but I have already 2 Foreign keys
> there. The problem is that I use this model for almost everything,

Hard to say without actually reading your code, but it really smells
like a huge design problem.


> BUT
> the foreign keys are used rarely, not to mention the third one that
> would be used this one time. Since each of these tables has 20k+
> (minimum) rows and the foreign keys are used rarely, if it wouldnt be
> better to use "one model class per select" - speed wise.

I still don't understand what this "one model class per select" is
supposed to mean.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django model per table vs model per select

2010-09-07 Thread Lukáš
Hey,

I am working with Django for a while and now that my "tree" and whole
DB is filled with data (note: existing database), I was wondering if
the "one model per table" is really better at this point than "one
model per select".

I have got one table - objtree. This is the place where I have all
nodes (brands, categories, tags, etc.) stored. As you can imagine it
is heavily used in my administration. Today I had to add another
foreign key for another table, but I have already 2 Foreign keys
there. The problem is that I use this model for almost everything, BUT
the foreign keys are used rarely, not to mention the third one that
would be used this one time. Since each of these tables has 20k+
(minimum) rows and the foreign keys are used rarely, if it wouldnt be
better to use "one model class per select" - speed wise.

Would this approach affect the speed at all? So far it worked fine for
me (model per table), but isnt that kind of an overkill for such large
DB?

Any opinion is appreciated.

Regards

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How do you avoid this race condition in Django?

2010-09-07 Thread Daniel Roseman
On Sep 7, 9:02 am, bruno desthuilliers 
wrote:
> The SQL "update" statement is atomic (well, it's supposed to be at
> least), so queryset.update should solve the problem (nb : not tested):
>
> YourModel.objects.filter(
>     pk=object.pk,
>     expiration_datetime < datetime.datetime.now()
>     ).update(
>       counter== F('counter') + 1,
>       expiration_datetime = F('expiration_datetime')  +
> datetime.timedelta(days=1)
>     )
>
> HTH

I was going to reply to this question with a similar proposal (note
you can't use "<" in a filter, it should be "__lt=") but it turns out
that F() doesn't work with anything other than strings or ints - dates
are out. (There doesn't seem to be any technical reason why this
should be, and I have been trying to work up a patch, but it's a very
complicated bit of code.)

I think raw SQL is the only way to solve this problem for now.
--
DR.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Custom view for admin section

2010-09-07 Thread vishy
Hi,

I have made a custom view for admin section.I have added a link in the
index page which calls this custom view.I have copied the index page
to templates\admin in my application, and added this link.But, I want
this link to appear in auth section.How can I do this?

thanks

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Having issue setting UP admin section in Dajngo

2010-09-07 Thread Ali Ahsan
Actually what is happening after login to admin
it keep up adding  setting.fcgi to URL


http://172.16.100.231/setting.fcgi/admin/
On Tue, Sep 7, 2010 at 2:28 PM, Ali Ahsan  wrote:

> Hi
>
> Do you have any idea what could be wrong.I am using lighthttpd with django
>
> On Tue, Sep 7, 2010 at 2:22 PM, Kenneth Gonsalves wrote:
>
>> On Tue, 2010-09-07 at 13:30 +0500, Ali Ahsan wrote:
>> > (r'^admin/(.*)', admin.site.root),
>>
>> as far as I remember this is correct for that version - so I do not
>> think I can help here ...
>>
>>
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Multiple languages question about /jsi18n/

2010-09-07 Thread revolunet
Same problem here

The django.views.i18n.javascript_catalog function only accepts
'django.conf' and/or any app in settings.INSTALLED_APPS.

/jsi18n/apps.main+apps.demo

This mean it cannot load locale data at the project level which is
annoying.

see http://github.com/django/django/blob/master/django/views/i18n.py#L154

Also, it load by default the djangojs catalog.

I tweaked my ursl.py this way to accept a domain parameter :

urlpatterns += patterns('',
(r'^i18n/',
include('django.conf.urls.i18n')),
# POST language to change current lang
(r'^jsi18n/?(?P[^/]+)?/?(?P[^/]+)?/?$',
'django.views.i18n.javascript_catalog'),  # serves the
javascript data
)





On 14 juil, 13:55, Stodge  wrote:
> Any ideas? This is driving me nuts. I've just hit a problem where I
> have strings defined for two apps:
>
> project/app1/locale
> project/app2/locale
>
> I added a new project app3 (project/app3/locale) and defined strings,
> compiled them but they're not available in the catalog. I'm starting
> to think there are major problems with language support in Django
> 1.1.2. I'm stuck on 1.1.2 as my app runs on a server I cannot control
> or upgrade.
>
> Thanks
>
> On Jun 7, 12:19 pm, Stodge  wrote:
>
>
>
> > Ok I think I see what's happening. I have js strings defined in
> > project/locale and project/app/locale.jsi18nisn't picking up the
> > project level strings but it is seeing the app strings. This doesn't
> > sound right to me.
>
> > On Jun 7, 9:06 am,Stodge wrote:
>
> > > I have thejsi18nview defined in my URLs. I've added a call to
> > > gettext() in javascript and added the string definition in
> > > djangojs.po. I then compiled the messages and re-started the server.
> > > But the resulting string retrieved from gettext() is the tag, e.g.
> > > 'my_title'.
>
> > > Did I forget something? I'm sure I have everything setup, but my
> > > catalog is always empty.
>
> > > On Jun 4, 10:49 am,Stodge wrote:
>
> > > > I think I have basic internationalisation working for english and
> > > > french. I can switch languages and change the page's title
> > > > accordingly. However, if I visit:
>
> > > > /jsi18n/
>
> > > > I see the catalog definition and a few gettext related functions etc.
> > > > However, these are defaults and the translations in the catalog are
> > > > not mine and are always french, regardless of the language.
>
> > > > What are these translations in the catalog and why are they always
> > > > french? Any ideas? Thanks

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Having issue setting UP admin section in Dajngo

2010-09-07 Thread Ali Ahsan
Hi

Do you have any idea what could be wrong.I am using lighthttpd with django

On Tue, Sep 7, 2010 at 2:22 PM, Kenneth Gonsalves  wrote:

> On Tue, 2010-09-07 at 13:30 +0500, Ali Ahsan wrote:
> > (r'^admin/(.*)', admin.site.root),
>
> as far as I remember this is correct for that version - so I do not
> think I can help here ...
>
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Having issue setting UP admin section in Dajngo

2010-09-07 Thread Kenneth Gonsalves
On Tue, 2010-09-07 at 13:30 +0500, Ali Ahsan wrote:
> (r'^admin/(.*)', admin.site.root),

as far as I remember this is correct for that version - so I do not
think I can help here ...
-- 
regards
Kenneth Gonsalves

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Strange unit test / OAuth Issue

2010-09-07 Thread Chris
So I wrote some django unit tests for an app that uses OAuth and I ran
into this strange issue when attempting to set my verifier:

On my local dev machine it likes me to set my verifier like so:
token.set_verifier(verifier)

On my production machine it like me to set my verifier like so:
oauth_request = oauth.OAuthRequest.from_consumer_and_token(
self.apicall.consumer,
token=token,
verifier=verifier,
http_url=self.apicall.access_token_url
)

Both my dev machine and production machine can't agree on which way
they would like to set the verifier. If I perform both methods, then
both dev and production seem to be happy!  Why is this? Could I have a
slightly different version of oauth on both the machines?

Here is the full snippet of code that sets the verifier and makes the
access token request:

verifier = "zNd4KsqnL9"
   # Dev likes it this way
token.set_verifier(verifier)

oauth_request = oauth.OAuthRequest.from_consumer_and_token(
self.apicall.consumer,
token=token,
# prod likes it this way
verifier=verifier,
http_url=self.apicall.access_token_url
)
oauth_request.sign_request(self.apicall.signature_method,
self.apicall.consumer, token
)
params = oauth_request.parameters
response = self.client.get(self.apicall.access_token_url,
params)

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Advice needed on bundling applications

2010-09-07 Thread Benedict Verheyen
Hi,


i've written a calltracking application for my company and other apps will 
follow soon.
Now, i would want a central way to access them and to assign rights on who can 
see
and run what application.
The dashboard or access panel will be very simple: icons that link to the 
application and based
on the user, some apps will not be visible.

I'm not sure as to what is the better approach.
i'm thinking of making a new project "dashboard" where i have a simple
model containing info like app name, icon, position on the dashboard and so on.
Easy enough.

However, in my calltracking i have all the logic of usermanagement (login, 
logout).
Do i copy this to my dashboard and remove it from the calltracking app so you
always have to login via the dashboard?
Or do i just copy it to the dashboard?

Another possibility is to make the dashboard the project and the calltracking 
an app in that project?
Is it possible to both use them as projects but still have one way to login so 
that if a user
is logged in on the dashboard, he/she is automatically logged in when accessing 
the
calltracking?


Thanks for any insights,
Benedict

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Having issue setting UP admin section in Dajngo

2010-09-07 Thread Ali Ahsan
Hi Keeneth

Sorry i was wrong django version is 1.0.4,And in same version app was
written.

below is my urls.py for admin section



 (r'^captcha_img/$','captcha_img'), #Captcha Image
#(r'^captcha_my_img/$','captcha_my_img'), #Captcha Image

(r'^admin/(.*)', admin.site.root),




On Mon, Sep 6, 2010 at 12:10 PM, Kenneth Gonsalves wrote:

> On Sun, 2010-09-05 at 22:29 -0700, aliahsan wrote:
> > 26. ^admin/(.*)
>
> this may be the offending line - which version of django are you using
> and which version of django was the app written for?
> --
> regards
> Kenneth Gonsalves
>
> --
> 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
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How do you avoid this race condition in Django?

2010-09-07 Thread bruno desthuilliers
On 6 sep, 15:45, Andy  wrote:
> I have a model MyModel that has a field expiration_datetime.
>
> Every time a user retrieves an instance of MyModel I need to first
> check if it has expired or not. If it has expired, than I need to
> increment some counter, update others, and then reset the
> expiration_datetime to some time in the future.
>
> So the view would do something like:
>
> if object.expiration_datetime < datetime.datetime.now():
>     object.counter = F('counter') + 1
>     object.expiration_datetime = F('expiration_datetime')  +
> datetime.timedelta(days=1)
>     object.save()
>
> There's a race condition in the code above. Say thread 1 checks and
> finds that the current instance has expired, it proceeds to increment
> the counter and reset the expiration datetime. But before it could do
> so, thread 2 is scheduled and does the same. By the time thread 1
> finally finishes, counter has been incremented twice and
> expration_datetime has been reset twice.
>
> This looks like a pretty common issue. How do I handle it?

The SQL "update" statement is atomic (well, it's supposed to be at
least), so queryset.update should solve the problem (nb : not tested):

YourModel.objects.filter(
pk=object.pk,
expiration_datetime < datetime.datetime.now()
).update(
  counter== F('counter') + 1,
  expiration_datetime = F('expiration_datetime')  +
datetime.timedelta(days=1)
)

HTH

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django-friends help

2010-09-07 Thread justin jools
Canyone with experience of django-friends give some setup guidelines.
I have read the docs but can't follow it easily, they are a bit sparse
for myself as beg-internediate level user.

I have installed: dajngo apps: registration, profiles, accounts,
messages, notifications and friends.

I'm having understanding how to connect the notice types to friends
and setup views and templates.

Thanks for your help

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Generate a daily serial/batch/lot number

2010-09-07 Thread Shamail Tayyab

On Tuesday 07 September 2010 04:46 AM, Mike Dewhirst wrote:
I'm reminded that almost all my own disasters were caused by premature 
optimisation.

Seconds that! :-)


I would go with the simplest solution and keep an eye on performance 
as it scales. Gives you plenty of time to research plan B.




--
Shamail Tayyab
Blog: http://shamail.in/blog

--
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django-tagging languages and multi fields

2010-09-07 Thread Henrik Genssen
Hi,

has someone a solution for tags in more than one language for the same entry?
I normally use transdb (1) to archive this on char or textfields. But what 
about tags in multi languages for one entry?

Has someone managed to get more than one tag field for a model? e.g. for 
internal and external tagging of an entry...

regards
Hinnack


(1) http://code.google.com/p/transdb/

Henrik Genssen

h...@miadi.net
Tel. 0451/6195650
Fax. 0451/6195655

miadi GmbH
Geschäftsführer: Henrik Genssen
Sitz der Gesellschaft: Beckergrube 2, 23552 Lübeck
Amtsgericht Lübeck HRB 10223, USt-IdNr DE
Lieferungen und Leistungen erfolgen ausschließlich auf Grundlage unserer 
allgemeinen Geschäftsbedingungen

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: GoFlow - anybody out there used it?

2010-09-07 Thread Thomas Guettler
Hi Steve,

please post your result here, if you looked at the different workflow
solutions.

  Thomas

Steve Boyle wrote:
> Hi,
> 
> I've been writing an application that requires a workflow component
> and rather than build one from scratch looked around to see what was
> already out there.
> 
> One app that was mentioned a number of times was "GoFlow" which
> apparently is based on "OpenFlow" a Zope product.
> 
> It feels as though the project has died judging by the activity /
> commits etc, and unfortunately my impression is that there is a *lot*
> of tidy up required on the code & docs.
> 
> Has anybody else actually used this project, and if so what are your
> thoughts?
> 
> It might save me investing a load of time in something that could have
> been better spent writing something from scratch.
> 
> Many thanks
> 
> 
> Steve
> 

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Generate a daily serial/batch/lot number

2010-09-07 Thread kmpm


On Sep 6, 8:40 pm, raj  wrote:
> Hi all,
> Why can't we use the aggregate function 'max' from within save()? I
> found it working to find the lot_max from among the objects filtered
> by prod_date and then if lot_max is None, lot_no must be 0, else it's
> just lot_max + 1. I don't know if I've misunderstood some requirement
> by the way.
>
> Raj.

We might have a race-condition if 2 or more occurrences of the same
event happens at the same time.
If to processes start on about the same time then both will get the
same 'max' from the database. The first that saves will be OK, the
second will get a IntegrityError because it tries to use the same
lot_no.
Thats why something a little more is needed but you are basically
right.

-- 
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.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.