can't open file 'django-admin.py': [Errno 2] No such file or directory'.

2010-10-29 Thread sami nathan
Whenever I try to execute a python script that is located in the
/usr/local/bin, python gives me the error 'python: can't open file
'django-admin.py': [Errno 2] No such file or directory'.

-- 
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 admin for call center support?

2010-10-29 Thread Laszlo Antal
Hi,

Yes. I wrote a customer care app with django for a call center with 40+ agents. 
It is now mostly have custom views and actions but the default django admin was 
used for a couple of months without any issues. I used proxy models to only 
show fields in the add client view they need to see(again I did it that way so 
I don't have to write any views for it).
I also over wrote the admin class queryset method to only show their own 
clients etc...
So yes it can be done just plan it out properly what they should have access to 
and use groups for user permissions. 

lzantal

On Oct 29, 2010, at 1:54 PM, mack the finger  wrote:

> I'm responsible for writing a customer service application for a
> django project, and it needs to be done by Monday (it's friday now).
> I'm currently getting it built with the Django Admin, but the bosses
> think the interface is too complex for the "knuckle-draggers" that
> commonly answer phones. I'm wondering is anyone out there has ever
> used the Django Admin for such purposes? Did you have to modify the
> interface in any way? Did your customer service agents have trouble
> navigating between the pages? Actually, has anyone out there ever had
> to deploy a Django Admin instance to a group of computer illiterate
> people? Were they able to cope?
> 
> -- 
> 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: admin usage

2010-10-29 Thread Carlos Daniel Ruvalcaba Valenzuela
I have always had the notion that the admin interface is more about
adding data to the system quickly rather than being the system itself,
the admin interface is very powerful indeed, but I think you may have
better customization/simplification options on your own and reserve
the admin interface for certain tasks (such as adding data like
inventory part numbers) that are not your daily use case o central
functionality.

Regards,
Carlos Daniel Ruvalcaba

On Fri, Oct 29, 2010 at 1:55 PM, Frank Wiles  wrote:
> On Fri, Oct 29, 2010 at 3:13 AM, Alex Kreimer  wrote:
>> Hi All,
>>
>> I'm building an app for small retail chain management.  It requires
>> inventory/salespeople/wages etc. management.  There 2 kinds of users:
>> updaters (non-tech managers that are responsible sales locations) and
>> viewers (main office managers that control the organization).
>>
>> 1 Would django admin be suitable for all the update tasks (it looks
>> like admin would be seriously tweaked for this) or should a separate
>> interface be built?
>>
>> 2 Is there a ready piece of code that could be used as a stub for such
>> a task?
>
> While you could definitely shoe horn this into the admin with a bunch
> of customizations, you're likely better off just writing your own
> interface for these tasks. My general rule of thumb is if the end user
> isn't "techie" or they will be using the interface many times per day
> I don't use the admin.
>
> Don't get me wrong, the admin is great, but it isn't ideal for many
> repetitive tasks.
>
> --
> Frank Wiles
> Revolution Systems | http://www.revsys.com/
> fr...@revsys.com   | (800) 647-6298
>
> --
> 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: admin usage

2010-10-29 Thread Frank Wiles
On Fri, Oct 29, 2010 at 3:13 AM, Alex Kreimer  wrote:
> Hi All,
>
> I'm building an app for small retail chain management.  It requires
> inventory/salespeople/wages etc. management.  There 2 kinds of users:
> updaters (non-tech managers that are responsible sales locations) and
> viewers (main office managers that control the organization).
>
> 1 Would django admin be suitable for all the update tasks (it looks
> like admin would be seriously tweaked for this) or should a separate
> interface be built?
>
> 2 Is there a ready piece of code that could be used as a stub for such
> a task?

While you could definitely shoe horn this into the admin with a bunch
of customizations, you're likely better off just writing your own
interface for these tasks. My general rule of thumb is if the end user
isn't "techie" or they will be using the interface many times per day
I don't use the admin.

Don't get me wrong, the admin is great, but it isn't ideal for many
repetitive tasks.

-- 
Frank Wiles
Revolution Systems | http://www.revsys.com/
fr...@revsys.com   | (800) 647-6298

-- 
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 admin for call center support?

2010-10-29 Thread mack the finger
I'm responsible for writing a customer service application for a
django project, and it needs to be done by Monday (it's friday now).
I'm currently getting it built with the Django Admin, but the bosses
think the interface is too complex for the "knuckle-draggers" that
commonly answer phones. I'm wondering is anyone out there has ever
used the Django Admin for such purposes? Did you have to modify the
interface in any way? Did your customer service agents have trouble
navigating between the pages? Actually, has anyone out there ever had
to deploy a Django Admin instance to a group of computer illiterate
people? Were they able to cope?

-- 
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: Subclassing AdminSite

2010-10-29 Thread Strav
Just solve my problem.

This was hinted in the doc but wasn't really clear anyways.

The registration has to be made in the same file instantiating your
admin subclass.
I'll submit a doc revision for that.

-- 
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 to develop cms on django

2010-10-29 Thread Oivvio Polite
> i dont have time i need to start development within  a month..
> 
> plz tell me all those crucial topics that i should learn

>From the little information I have about your situation I'd say your
better of using a readymade CMS like Wordpress. As much as I love
Django, I do think that you'll be settings yourself up for a world of
pain if you need to have a site up withing a month and have no
previous experience with python. 

oivvio


-- 
http://pipedreams.polite.se/about/


-- 
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 new classbased generic views in contrib.databrowse

2010-10-29 Thread Michael
Hi,

Do you think it is relevant to rewrite databrowse to use the new class-
based generic views ?
I'm motivate to work around this and submit a patch, but want first to
discuss about what to do..
IMHO, contrib.databrowse (using class-based views) can provide a
reusable/extendable "base" for rapid development.

Do you use databrowse ? and how (extending the classes ? , or just by
providing your own the template ?)
a JSON/CSV/XLS output could be useful too in databrowse (theses two
last formats could also become core.serializers btw.)

Michael

-- 
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 formsets with multiple models

2010-10-29 Thread Bill Brigham
Hi,

I'm creating an online questionnaire for my local community college,
and hitting a brick wall dealing with formsets. Please can someone
point me in the right direction?

On a questionnaire, you have one or more questions which will require
either an essay answer or multiple choice answers. When creating a new
questionnaire, I would like to show a textarea for the Question.text
common to both types, a radio select for the Question.question_type,
and then present either the EssayQuestion.initial_answer textarea or
the inputs for adding multiple choice options. The user can click "add
question" to append another form beneath to enter a new question. It's
only on the final "save questionnaire" that I handle the POST and
save.

I have spent a few days now trying different permutations of
formsets, modelformsets and inline_formsets but to no avail. The
closest I've got is to create a QuestionFormset, EssayQuestionFormset
and a MultipleChoiceQuestionFormset, then keep track of which form
belongs to which question when saving. I'm not sure how to reconstruct
the forms should it raise validation errors though.

Another option is to create a QuestionForm containing fields for 0..N
possible fields, i.e. multiplechoice_choice_0,
multiplechoice_correct_0, multiplechoice_choice_1,... But this feels
wrong to me.

It seems overly complicated which makes me think I'm going about it
the wrong way. Any help would be much appreciated please!

Thanks,

Bill

Here's my models.py, let me know what else may help.

models.py

class Questionnaire(models.Model):
name = models.CharField()

class Question(models.Model):
questionnaire = models.ForeignKey(Questionnaire)
question_type = models.CharField(choices=QUESTION_TYPES)
text = models.TextField()

class EssayQuestion(models.Model):
question = models.OneToOneField(Question)
initial_answer = models.TextField()

class MultipleChoiceQuestion(models.Model):
question = models.ForeignKey(Question)
choice = models.CharField()
correct = models.BooleanField()

-- 
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 I filter/exclude custom queryset fields created by .extra()?

2010-10-29 Thread Miguel Araujo
Hi,

Try always not to think SQL and not to use extra. Most of the times there is
an alternative without extra. Extra is advanced.

class Node(Model):
   widgets = ForeignKey(Widget)

This query will give you all the different nodes that have the foreign key
widgets set to something different than null:

Node.objects.filter(widgets__isnull = False).distinct()

As your ForeignKey widgets can not be null, all nodes in the table will
point to at least one widget. So it's the same as if you do:

Node.objects.all().distinct()

Maybe you want to do this:

class Node(Model):
   widgets = ForeignKey(Widget, null=True)

Regards,
Miguel Araujo


2010/10/29 Jumpfroggy 

> From a raw SQL standpoint, I've figured out that these constraints
> need to be in the HAVING clause, not the WHERE clause.  But it looks
> like HAVING is not exposed through the .extra() function, which would
> seems logical.  It appears you can create extra fields, but due to
> this lack you can't filter on them.  Is there another way to customize
> the HAVING field?
>
> --
> 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 I filter/exclude custom queryset fields created by .extra()?

2010-10-29 Thread Jumpfroggy
>From a raw SQL standpoint, I've figured out that these constraints
need to be in the HAVING clause, not the WHERE clause.  But it looks
like HAVING is not exposed through the .extra() function, which would
seems logical.  It appears you can create extra fields, but due to
this lack you can't filter on them.  Is there another way to customize
the HAVING field?

-- 
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.



Aggregates are giving the wrong numbers for .annotate()? What am I doing wrong?

2010-10-29 Thread Jumpfroggy
Hi all,

I've been working in django for a while now, but am still wrapping my
head around the more complex queryset features.

I have something like this:

class Foo:
name = CharField()
bars = ForeignKey(Bar)
widgets = ForeignKey(Widget)

I can do this:

Foo.objects.extra(select={
'num_bars': 'SELECT COUNT(*) FROM app_bar WHERE app_bar.foo_id =
app_foo.id',
'num_widgets': 'SELECT COUNT(*) FROM app_widget WHERE
app_widget.foo_id = app_foo.id',
})

That gives me what I want... a list of all foo's with counts of how
many bars & widgets it's linked to.

NameNum BarsNum Widgets
First   1   4
Second  2   3

However, I wanted to use annotations.  So I do this:

Foo.objects.annotate(num_bars=Count(bar), num_widgets=Count(widget))

But I get increased counts:

NameNum BarsNum Widgets
First   19  19
Second  5   5

When I spit out the str(queryset.query) var, I get SQL like this:

SELECT
app_foo.name,
COUNT(app_bar.id) AS num_bars,
COUNT(app_widget.id) AS num_widgets
FROM app_foo
LEFT OUTER JOIN app_bar ON ...
LEFT OUTER JOIN app_widget ON ...
WHERE ...
GROUP BY app_food.id

This seems to fail because each LEFT OUTER JOIN gives multiple rows
for each match in the resulting table.  Then when COUNT() goes to
work, it will count each of the duplicate rows as another entry.  Then
all the COUNT() vars end up being a) larger, and b) the same as each
other, since they're all counting the end-result rows.

I've tried .distinct(), but it does not fix the problem.  Am I
misunderstaning .annotate()?  Is this a bug?  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.



Today I released my first Django-app

2010-10-29 Thread Miguel Araujo
Hi everyone!

I hope this message is not seen as spam. Today I released my first
Django-app as Open Source on Github. It's called django-rules. It's an
authorization backend that you can use to flexibly manage per object
permissions in your Django projects. I find it very useful and I'm sending
this notice here, so you get to know about it. Project's website is:
http://github.com/maraujop/django-rules

Best regards,
Miguel Araujo

-- 
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: Forms in a Workflow for Related Models

2010-10-29 Thread Miguel Araujo
Hi,

You will need to go step by step. First you ask the user for the reviewer
with a form. Then the user has to submit the form. You manage your input
form and see if the data for that reviewer already exists, if it does, then
you load initial data in the second form. Now you redirect the user to the
second form, empty or loaded. This is the usual HTML web application flow,
not related to Django.

If you want things to happen dynamically, you will have to use AJAX, you can
use any JS library you like.

Best regards,
Miguel



2010/10/29 ghachey 

> Hi,
>
> I think I have a particular case.  I could not find an easy way to do
> this going carefully through all the documentation.  I also couldn't
> find anything close enough in these archives to help me out with my
> limited experience so I am resorting to asking you.
>
> I have a Paper model which records research paper information
> (references for a given paper).  And, I have a Questionnaire model
> which records a questionnaire instance for a given paper instance.
> They look like this,
>
> class Paper(models.Model):
>  author = models.CharField(max_length=256)
>  title = models.CharField(max_length=256)
>  .
>  .
>
> class Questionnaire(models.Model):
>  paper = models.ForeignKey(Paper,
> db_column='paper_fk',blank=True,null=True)
>  reviewer = models.CharField(
>verbose_name="Who is the reviewer?",
>max_length=5,choices=REVIEWERS,unique=True)
>  question1 = models.CharField(max_length=256)
>  .
>  .
>
> I have a view that pulls all paper instances (for a particular
> research) showing the title and the abstract only on a page.  I would
> like to be able to click on the title of any one of the papers opening
> a new browser window in which I could complete a questionnaire for
> that particular paper.
>
> Ideally, it would ask first which *reviewer* would like to submit (or
> update) a questionnaire for that paper (see the Questionnaire model).
> Subsequently, it would show an empty Questionnaire form (if reviewer
> has not submitted a questionnaire for that paper yet) or the
> previously submitted instance of that questionnaire for that paper by
> that reviewer.
>
> I simply cannot find an easy way of achieving this.  I have looked at
> inline formset (with online one inline), a combination of forms, etc.
> but none of those seem to do what I want easily.
>
> Any ideas would be greatly appreciated, even telling me to do this in
> a completely different way.
>
> Thank you,
>
> --
> GH
>
> --
> 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: Multiple Django/Python developer Positions- Atlanta, GA

2010-10-29 Thread Venkatraman S
On Fri, Oct 29, 2010 at 10:27 PM, Kenneth Gonsalves wrote:

> On Fri, 2010-10-29 at 07:18 -0700, Jack wrote:
> > only US Citizens or Greencard holders need apply
>
> please do not put things like this on an international list
>

I hear that there are many many unclaimed H1B slots :)
But OTOH, i dont think its much of a problem when the recruiter clearly
mentions the criteria; you dont want to get loads of applicants which do not
satisfy the basic criteria.

-V-

-- 
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 Django/Python developer Positions- Atlanta, GA

2010-10-29 Thread Kenneth Gonsalves
On Fri, 2010-10-29 at 07:18 -0700, Jack wrote:
> only US Citizens or Greencard holders need apply

please do not put things like this on an international list
-- 
regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC

-- 
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.



Multiple Django/Python developer Positions- Atlanta, GA

2010-10-29 Thread Jack
Good Morning!

I am looking for Django/Python developers to join the team of one our
clients in Atlanta, GA working on one of the largest Django apps EVER
in  - scaled to serve web,mobile, and more for 100+ prominent
newspaper, TV, and radio sites! There are 3-5 job openings and they
are looking for someone who can hit the ground running! Please send me
an e-mail at jmabb...@apexsystemsinc.com or call at (770) 481-0044 and
I would love to tell you more details!

Company:  Leading communications, media and automotive services
company.
Role:  Application Developer
Length:  6 Month to Hire
Location:  Atlanta, GA
Interview Process:  Phone and Face to Face
Compensation:  60k to 100k

Please reply if you or someone you know if looking for a job as a
expert Python or Django Developer.

only US Citizens or Greencard holders need apply

Thanks!

Jack

-- 
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: Model Inheritance.

2010-10-29 Thread Miguel Araujo
Hi Tom,

You might want to have a look at inheritanceCastModel from
django-model-utils by Carl Meyer
http://github.com/carljm/django-model-utils

Best regards,
Miguel Araujo

2010/10/29 David De La Harpe Golden 

> On 29/10/10 00:04, Tom Eastman wrote:
>
>  That's correct, but I want to take a 'Place' object, that doesn't have a
>> 'restaurant', and turn it *in to* a 'Restaurant' by adding the
>> corresponding row to the Restaurant table.
>>
>
>
> So you have a place.
>
> p = Place(name="3rd Circle of Hell")
> p.save()
>
> This should work:
>
> r = Restaurant(serves_hot_dogs=True)
> r.place_ptr = p
> r.save()
>
> If you then want an r that has picked up the now-should-be-inherited place
> attrs, you'll have to do something like:
>
> r = Restaurant.objects.get(pk=r.pk)
>
> print r.name
> 3rd Circle of Hell
>
>
>
> --
> 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: Subclassing AdminSite

2010-10-29 Thread Strav
Forgot to say:

If I replace:
 (r'^', include(alternate_admin.urls)),
with
 (r'^', include('alternate_admin.urls')),

I can see the models I've got registered with my alternate admin but
the url reversing is messed up, i.e.: logout does not point to /logout
but to /admin/logout (while /admin/logout would be the logout page for
my other admin instance)

...

-- 
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: Import csv file in admin

2010-10-29 Thread Jorge
Jirka

I need an easy method inside the admin to upload the csv file with an
web interface. I guess with your method the admin will need access to
the server and the command line, and something like this is not what i
try to do, because the admin (not me) is not a django developer, not
even a user get used to command lines. But if my guessing is wrong how
can i do a web interface for your method?

Regards!

On Oct 29, 5:44 am, Jirka Vejrazka  wrote:
> I must still be missing something here. If all you want to do is to
> read CSV file and save the data in the database, I still don't
> understand why you use the forms machinery.
>
> You only *need* to use the data model, e.g.
>
> from myapp.models import Data
>
> csvfile = csv.reader('something.csv')
>
> for line in csvfile:
>   do_necessary_data_conversions_or_checks(line)
>   try:
>     Data.objects.create(field1=line[0], field2=line[1], ...)
>   except (IndexError, IntegrityError):
>     print 'Invalid line encountered:\n%s' % line
>
>   What am I missing?
>
>    Jirka

-- 
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 python-magic on request.FILES['datafile']

2010-10-29 Thread wawa wawawa
And again, I solve a problem exactly 14 seconds after asking it...

DOH!

I had a hander method that was reading the file object prior to the
tests. So, the "empty" was actually correct.

I changed the order of the methods and it alls works as expected now.

Oops.

W

On 29 October 2010 18:15, wawa wawawa  wrote:
> Hi All,
> I'm trying to allow some flexibility for my end users. I want to
> support the uploading of multiple file archive types (tar.gz,
> tar.bzip2, zip, rar etc).
> I want to use python-magic to guess the filetype from the files magic
> number and then use the appropriate decompression modules to get at
> the data in the files.
> Basically, I'm not sure how to make the type of the
> request.FILES['datafile'] be compatible with the requirements of
> python-magic (which needs a file-location or a string)
>
> I have a view:
>
> def upload_file(request):
>      c ={}
>      c.update(csrf(request))
>      if request.method == 'POST':
>         frag = request.FILES['datafile'].read(65536)
>         ft = magic.from_buffer(frag)
>         res = {}
>         res.update({ "result" : ft })
>         res.update({ "datafile" : type(request.FILES['datafile']) })
>         res.update({ "frag"  : type(frag) })
>         return render_to_response("simple.html", {'content': res })
>      else:
>         form = UploadFileForm()
>         return render_to_response('upload.html')
> "simple.html" just outputs the data structure "res", as below.
>
> {'content':
>     {'datafile':  'django.core.files.uploadedfile.TemporaryUploadedFile'>,
>      'frag': ,
>      'result': 'empty'}}
>
>
> I've tried different combinations of magic.from_file and
> magic.from_buffer and both read() and chunk() from the
> TemporaryUploadedFile object but I either get a type error or an
> "empty" result. I think the above should work fine!
>
> Using python-magic on the temp object that's been uploaded (and saved
> to disk 'cos is > 2.5MB) works with both
> magic.from_buffer(open("f").read(65536)) and magic.from_file("f").
>
> Any ideas?
>
> (also, anyone have any quick drop in helper methods for debugging I
> can use instead of the horrible "res" dict I'm using?)
>
> Thanks in advance
>
> Wa
>

-- 
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: adding field to query set

2010-10-29 Thread Jumpfroggy
If it were my project, I'd probably add this kind of custom field to
your mapping:

mapping = {
# list the normal columns first... then:
'full_name': ['user__first_name', 'user__last_name'],
}

Then your render code would be something like this:

def render(self):
for row in self._data:
for name, value in self._mapping.items():
print 'name: %s' % name
if hasattr(value, '__iter__'):
final_value = []
for value2 in value:
final_value.append(getattr(row, value2))
final_value = ' '.join(final_value)
else:
final_value = getattr(row, value)
print 'final_value: %s' % final_value

-- 
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 python-magic on request.FILES['datafile']

2010-10-29 Thread wawa wawawa
Hi All,
I'm trying to allow some flexibility for my end users. I want to
support the uploading of multiple file archive types (tar.gz,
tar.bzip2, zip, rar etc).
I want to use python-magic to guess the filetype from the files magic
number and then use the appropriate decompression modules to get at
the data in the files.
Basically, I'm not sure how to make the type of the
request.FILES['datafile'] be compatible with the requirements of
python-magic (which needs a file-location or a string)

I have a view:

def upload_file(request):
     c ={}
     c.update(csrf(request))
     if request.method == 'POST':
        frag = request.FILES['datafile'].read(65536)
        ft = magic.from_buffer(frag)
        res = {}
        res.update({ "result" : ft })
        res.update({ "datafile" : type(request.FILES['datafile']) })
        res.update({ "frag"  : type(frag) })
        return render_to_response("simple.html", {'content': res })
     else:
        form = UploadFileForm()
        return render_to_response('upload.html')
"simple.html" just outputs the data structure "res", as below.

{'content':
 {'datafile': ,
  'frag': ,
  'result': 'empty'}}


I've tried different combinations of magic.from_file and
magic.from_buffer and both read() and chunk() from the
TemporaryUploadedFile object but I either get a type error or an
"empty" result. I think the above should work fine!

Using python-magic on the temp object that's been uploaded (and saved
to disk 'cos is > 2.5MB) works with both
magic.from_buffer(open("f").read(65536)) and magic.from_file("f").

Any ideas?

(also, anyone have any quick drop in helper methods for debugging I
can use instead of the horrible "res" dict I'm using?)

Thanks in advance

Wa

-- 
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: Converting Django to Desktop App? (Multiple Instances)

2010-10-29 Thread Bill Freeman
This will work.  Concurrency is Oracle's problem.  Each Django is a
client, and gets a separate connection to Oracle.  Transaction
management is bread and butter to the big databases.

That said, you may not need apache.  This sounds like a group of
cooperating users with a very low request rate, so even the development
server may be enough.

Also, if you have a box amongst you that is always up, it might be easier
to manage a scheme with Django on just that system, so long as the
intranet allows all of you to route to the one box (corporate enforced
per system firewalling could be an issue here).

The downside of running your own PostgreSQL (or MySQL if you must) is
that corporate backup procedures applied to the Oracle server may not
be applied to your data, giving you something else to manage.  On the
other hand, you need to be sure that you have table creation, etc.,
permissions, of which IT may be jealous.

On Fri, Oct 29, 2010 at 3:33 AM, Victor Hooi  wrote:
> Hi,
>
> This is a bit of a strange scenario.
>
> We have a simple Django application used to maintain a database of
> newspaper/journal articles. We're extensively using the django-admin
> as part of this app.
>
> Currently, we're having issues getting a production environment with
> Python provisioned (corporate environment, locked technology roadmap
> etc.), however, we will have access to a Oracle database instance.
>
> One possibility raised was that for each of the clients (fairly small,
> under 5), we install a local instance of Django and Apache, which they
> access with their browser, and each of these instances communicates
> with a single Oracle DB instance.
>
> I know on the Rails side, there was a product by Joyent called
> Slingshot (http://joyeur.com/2007/03/22/joyent-slingshot/), which
> allegedly did something similar (packaged up a RoR app into a desktop
> application).
>
> Are there any particular issues we need to be aware of if we decided
> to go down this path?
>
> In particular, I wasn't sure how multiple instances of Django would
> handle concurrency if they were communicating with a single database.
> Any advice there?
>
> Any other possible drawbacks/roadblocks?
>
> Cheers,
> Victor
>
> --
> 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.



server configuration

2010-10-29 Thread bax...@gretschpages.com
I'm finding conflicting info regarding preferred server
configurations.

I'm using Nginx for static, passing off to Apache/mod_wsgi for django
stuff. Currently, wsgi is in daemon, and I'm using the worker MPM.
>From some sources I've seen that is ideal, but I notice in the django
docs that prefork MPM is better. But then I read you can't use prefork
if wsgi is in daemon mode.

So I'm confused, and hoping someone can clarify for me.

-- 
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: Converting Django to Desktop App? (Multiple Instances)

2010-10-29 Thread Javier Guerra Giraldez
On Fri, Oct 29, 2010 at 3:41 AM, Mike Dewhirst  wrote:
> That looks a bit 'under the radar' with regard to locked roadmap etc. Why
> not dig the pit a bit deeper and make your own server with Apache, Django
> and your Oracle db. Much cleaner than Apache/Django everywhere.

also, if it's going to be a 'hidden server', no need to use Oracle.
MySQL and PostgreSQL are way more than enough.  heck, even SQLite
should cope with such a small load.

-- 
Javier

-- 
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: write a filter for latex that escapes some chars

2010-10-29 Thread Brian Bouterse
We have done this before and used something like the code below.  This
sample is pretty basic.

   def fixchar(string,char):

#fixes chars for latex

if char == '<':

newchar = '$<$'

elif char == '>':

newchar = '$>$'

elif char == '~':

newchar = '\\~{}'

else:

newchar = '\\' + char

string = string.replace(char,newchar)

return string

On Fri, Oct 29, 2010 at 9:03 AM, SlafS  wrote:

> Hi there!
>
> I'm trying to write a filter that can be used inside of a template
> that is used for generating latex files.
>
> The filter should replace the '|' char with '\'. Simple:
>
> @register.filter("verb_safe")
> def verb_safe(val):
>return str(val).replace('|', '\|')
>
> is outputting me '\\|'
>
> I'm littlle confused about that.
>
> Please help
>
> 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.
>
>


-- 
Brian Bouterse
ITng Services

-- 
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.



write a filter for latex that escapes some chars

2010-10-29 Thread SlafS
Hi there!

I'm trying to write a filter that can be used inside of a template
that is used for generating latex files.

The filter should replace the '|' char with '\'. Simple:

@register.filter("verb_safe")
def verb_safe(val):
return str(val).replace('|', '\|')

is outputting me '\\|'

I'm littlle confused about that.

Please help

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: Cherokee for home developing

2010-10-29 Thread Max Countryman
This may be of use to anyone using any version of Cherokee prior to 1.09:

http://lists.octality.com/pipermail/cherokee/2010-September/013432.html

There are several threads that detail the manual set up process. But the key 
here is that the wizard is, as Roberto states, "(currently) totally broken," so 
don't use it! Manual set up is fairly intuitive and not difficult.

Karim, you may find that refreshing your project is easier with uWSGI as 
opposed to something like FastCGI, in reference to your question about having 
to restart Cherokee each time you make changes.

Regards,


Max

-- 
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: Cherokee for home developing

2010-10-29 Thread Robbington

Karim,

If you hve not already quit reading these posts(I wouldnt blame you if
you had) I want to once again apologise.

I only posted as I was glad to see someone else using Cherokee and
wished to offer a small insight into another way of serving python
code.

The whole thing has become idiotic and I am in part to blame.

I hope that you have taken a small amount of useful information from
all this and continue to develop some great apps.

Regards

Rob

-- 
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: Cherokee for home developing

2010-10-29 Thread Robbington
"Anyway, my intent here was to help. It's ridiculous how everything
has to be reduced to pedantic argumentation and sanctimonious advice
about what to post where."

I was trying to be courtesy towards Karim as this is his post.

Consider, Max, whether this post would have been better had you not
contributed at all.
I don't see how anything you have posted has been of great use as he
clearly stated he 'Might try using Uwsgi if he runs into more trouble'

You didn't even ask him what version of cherokee he is using, nor have
you posted any material to assist him if he wished to use uwsgi.

All you have done is stamp your feet about an issue that is
essentially mute.

I do not wish to be rude, and I asked you to email me directly because
I did not want to perpetuate this pathetic and pointless debate in a
public forum any longer, but for all intensive purposes you really are
a complete tool.

-- 
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: Cherokee for home developing

2010-10-29 Thread Max Countryman
Generally, yes.

If you're using a socket, you can rm the socket path each time you update. That 
will avoid the need to restart Cherokee.

On Oct 29, 2010, at 4:31 AM, Karim Gorjux wrote:

> I have just one question. While I'm editing the source of the project,
> to see the result I have always to restart the server or there is
> another way?
> 
> -- 
> K.
> Blog Personale: http://www.karimblog.net
> 
> -- 
> 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: Cherokee for home developing

2010-10-29 Thread Max Countryman
Rob, 

I don't want to email you directly. I'm sure you're a nice guy and everything, 
but I'm on this list to contribute to the list. Please stop asking this. That 
*is* obnoxious.

I'm sorry you see my comments as unhelpful or "unconstructive[sic]", however 
please remember you are not the only one reading or contributing to this list; 
please don't be judge and jury, some people find that insufferable,

Thank you,


Max

On Oct 29, 2010, at 6:48 AM, Robbington wrote:

> Dear Paul and Max,
> 
> As I mentioned before please email me directly should you wish to
> continue this discussion further, and or create a new post. I feel it
> unfair to discuss this in this particular forum as it is unrelated to
> the original subject matter.
> 
> I meant no offense to Max, I can see how the word obnoxious can be
> construed as such and I apologise, I merely meant I felt his comments
> were unconstructive in context.
> 
> Regards
> 
> Robert Dean
> robbing...@hotmail.co.uk
> 
> -- 
> 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: Model Inheritance.

2010-10-29 Thread David De La Harpe Golden

On 29/10/10 00:04, Tom Eastman wrote:


That's correct, but I want to take a 'Place' object, that doesn't have a
'restaurant', and turn it *in to* a 'Restaurant' by adding the
corresponding row to the Restaurant table.



So you have a place.

p = Place(name="3rd Circle of Hell")
p.save()

This should work:

r = Restaurant(serves_hot_dogs=True)
r.place_ptr = p
r.save()

If you then want an r that has picked up the now-should-be-inherited 
place attrs, you'll have to do something like:


r = Restaurant.objects.get(pk=r.pk)

print r.name
3rd Circle of Hell


--
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: Cherokee for home developing

2010-10-29 Thread Max Countryman

On Oct 29, 2010, at 5:45 AM, Robbington wrote:

> Actually I mentioned Uwsgi,

You missed where I referenced, where was here:

On Oct 28, 2010, at 2:27 PM, Karim Gorjux wrote:

> Now I solved all my problems working with settings.py. Seems that also
> the debug works, but If I'll be again in trouble I'll get a try at
> uwsgi.


Again, this covered in /great detail/ on the Cherokee list: currently the 
wizard produces a configuration and is broken, so there are other methods for 
manually setting up a source in Cherokee that uses uwsgi.

Anyway, my intent here was to help. It's ridiculous how everything has to be 
reduced to pedantic argumentation and sanctimonious advice about what to post 
where.

-- 
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: Start project not working

2010-10-29 Thread Jirka Vejrazka
Hi,

  first of all, if you will be sending emails like these, you're
likely to get ignored by people who are otherwise happy to anser
questions like yours (hint: 3 consecutive emails about the same topic
in 2 conferences, "anonymous" user etc.)

  Now for the real "answer". You have not told us anything to identify
the issue. Your django-admin.py is clearly working as it responded
with a standard error message (no need to copy in full to the email).
This message appears if parameters supplied to django-admin.py were
incorrect. Since you have not actually shown what exactly you've
typed, no one will be able to tell you what is wrong. I'm going to
guess that you have not typed "django admin-py startproject
myproject". This would not give you the "usage" message.

  Cheers

Jirka

-- 
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: Cherokee for home developing

2010-10-29 Thread Robbington
Dear Paul and Max,

As I mentioned before please email me directly should you wish to
continue this discussion further, and or create a new post. I feel it
unfair to discuss this in this particular forum as it is unrelated to
the original subject matter.

I meant no offense to Max, I can see how the word obnoxious can be
construed as such and I apologise, I merely meant I felt his comments
were unconstructive in context.

Regards

Robert Dean
robbing...@hotmail.co.uk

-- 
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.



Subclassing AdminSite

2010-10-29 Thread Strav
Hi, I must say I'm kinda lost here. Any help would greatly be
appreciated!

I wish to have two seperate admin sites on the same django project.

First thing I did, was create the app: alternate_admin
within alternate_admin, I have admin.py where I defined the following:

from django.contrib.admin.sites import AdminSite
class AltAdmin(AdminSite):
pass

alternate_admin = AltAdmin(name="Alternate Admin")

then at my project's root, in urls.py, I have:

from django.contrib import admin
from alternate_admin.admin import alternate_admin

...

admin.autodiscover()

urlpatterns = patterns('',
# Admin
(r'^admin/', include(admin.site.urls)),
(r'^',
include(alternate_admin.urls)),
# Sitemap
(r'^%s/' % settings.DAJAXICE_MEDIA_PREFIX,
include('dajaxice.urls')),
# Apps
(r'^profile/', include('profile.urls')),
url(r'^admin_tools/',
include('admin_tools.urls')),
(r'^account/',
include('django_authopenid.urls')),
(r'^trads/update/', 'trads.views.update'),
(r'^grappelli/',
include('grappelli.urls')),
)

I then proceed to register some admin models:

from alternate_admin.admin import alternate_admin

...

(my admin model def)

alternate_admin.register(MyModel, MyAdminModel)


Now if I try to log into the alternate admin as a super user, I can
log sucessfully but then I'm getting the "You don't have permission to
edit anything." message.

I checked the template and it seems this messages comes out when your
app_list is empty so I went and traced whether or not my models were
correctly registering with alternate_admin. At a first glance, they
indeed register but prior to the index loading, app_list is in fact
empty.

Then I noticed something odd with my urls.py:

If I replace:
 (r'^', include(alternate_admin.urls)),

with
 (r'^', include('alternate_admin.urls')),

and then go into alternate_admin/urls.py  and enter:

from alternate_admin.admin import alternate_admin
patterns = alternate_admin.get_urls()

If I log into alternate_admin, I do see the apps containing the models
I registered.

Another strange thing (at least to me), is that if I inverse the urls
order
(r'^', include(alternate_admin.urls)),
(r'^admin/', include(admin.site.urls)),

I noticed that admin/ is not reachable anymore.

Perhaps my urls.py is messed up.

I'd really appreciate if someone can shed some light on 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.



to_locale case formatting

2010-10-29 Thread Mathias Kretschek
Hi, everyone.

When I call to_locale on a language code, it acts as I expected. But,
when I call it on an already formated locale, it will lowercase the
region code.

>>> from django.utils.translation import to_locale
>>> to_locale('en-us')
'en_US'
>>> to_locale('en_US')
'en_us'
>>> to_locale('en_us')
'en_us'

Wasn't it supposed to always return a locale in the same format? In
theory, shouldn't the following statement be True?

to_locale('en-us') == to_locale('en_US') == to_locale('en_us') ==
to_locale(to_locale('en-us'))


django.utils.translation.trans_real.to_locale allows me to specify if
I'd like to always get a lowercase locale using the to_lower
parameter. But this parameter is NOT available in
django.utils.translation.to_locale neither in
django.utils.translation.trans_null.to_locale.

Am I missing something here? (I'm new to i18n and l10n.) I don't think
it's a big deal (since all locale codes I'm using follow the same
format), but I've just spent some time trying to understand why it
acts this way and couldn't figure it out.

Thank you.
Mathias Kretschek

-- 
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: Start project not working

2010-10-29 Thread saam andreson
my any of the sub command is not working thanks for reffering

-- 
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.



admin usage

2010-10-29 Thread Alex Kreimer
Hi All,

I'm building an app for small retail chain management.  It requires
inventory/salespeople/wages etc. management.  There 2 kinds of users:
updaters (non-tech managers that are responsible sales locations) and
viewers (main office managers that control the organization).

1 Would django admin be suitable for all the update tasks (it looks
like admin would be seriously tweaked for this) or should a separate
interface be built?

2 Is there a ready piece of code that could be used as a stub for such
a task?

Thanks,
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.



Start project not working

2010-10-29 Thread saam andreson
django-admin.py startproject myproject command not responding anything
please help me with suggestion Response comes as like this
i installed python2.5 and django official version and also copied admin.py
in scripts but when i use django admin-py startproject myproject is not
working it s showing the following message my system path looks like this
C:\Python25\Scripts;C:\Python25;C:\Program
Files\Subversion\bin;C:\Python25\Lib\site-packages\django;C:\Python25\Scripts\;C:\Django-1.2.3\django;C:\Python25\Scripts\django-admin.py



Usage: django-admin.py subcommand [options] [args]

Options:
  -v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=all output
  --settings=SETTINGS   The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided,
the
DJANGO_SETTINGS_MODULE environment variable will be
used.
  --pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
  --traceback   Print traceback on exception
  --version show program's version number and exit
  -h, --helpshow this help message and exit

Type 'django-admin.py help ' for help on a specific subcommand.

Available subcommands:
  cleanup
  compilemessages
  createcachetable
  dbshell
  diffsettings
  dumpdata
  flush
  inspectdb
  loaddata
  makemessages
  reset
  runfcgi
  runserver
  shell
  sql
  sqlall
  sqlclear
  sqlcustom
  sqlflush
  sqlindexes
  sqlinitialdata
  sqlreset
  sqlsequencereset
  startapp
  startproject
  syncdb
  test
  testserver
  validate

-- 
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: Cherokee for home developing

2010-10-29 Thread Paul Menzel
Dear Rob,


Am Freitag, den 29.10.2010, 02:45 -0700 schrieb Robbington:

[…]

> Actually I mentioned Uwsgi,
> 
> Perhaps if you are going to state potential bugs with software you
> could be so kind as to add the specifics in your posts and not just
> ambiguous statements such as "Do not use the uwsgi wizard: it's
> currently broken" we are not all as dedicated to the Cherokee mailing
> list as your good self. I had a quick look, here is a small excerpt:
> 
> "If you manually set the uWSGI source you will have no problem but the
> wizard make wrong assumptions"
> 
> Now I appreciate, as I am sure my fellow Django-ers are, that you
> brought this issue to light, but you could have saved some trouble as
> I mentioned before.

I agree. Pasting links to the archives is always beneficial for the
readers of the messages.

> I cant help but feel your tone to be slightly obnoxious, maybe that's
> just me, but these forums are to share experience and assist those who
> are new or have a problem. You would do well to acknowledge that.

I did not find Max’s style obnoxious, he stated the matter very
outright(?)/brisk. (I prefer interleaved style when replying though
[1].)

Thank you for all your input.

[…]


Thanks,

Paul


[1] 
https://secure.wikimedia.org/wikipedia/en/wiki/Posting_style#Placement_of_replies


signature.asc
Description: This is a digitally signed message part


Re: Cherokee for home developing

2010-10-29 Thread Robbington
Hey Karim,

The best way to save yourself time and effort is really to use the
Django development server when testing out alterations.


Max,

Actually I mentioned Uwsgi,

Perhaps if you are going to state potential bugs with software you
could be so kind as to add the specifics in your posts and not just
ambiguous statements such as "Do not use the uwsgi wizard: it's
currently broken" we are not all as dedicated to the Cherokee mailing
list as your good self. I had a quick look, here is a small excerpt:

"If you manually set the uWSGI source you will have no problem but the
wizard make wrong assumptions"

Now I appreciate, as I am sure my fellow Django-ers are, that you
brought this issue to light, but you could have saved some trouble as
I mentioned before.
I cant help but feel your tone to be slightly obnoxious, maybe that's
just me, but these forums are to share experience and assist those who
are new or have a problem. You would do well to acknowledge that.

Regards

Rob

Ps, apologies to Karim for unnecessary posts.

-- 
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 to aggregate values by month

2010-10-29 Thread sebastien piquemal
Hi !

You could also give django-cube a try :
http://code.google.com/p/django-cube/
Unlike Mikhail's app, the aggregates are not efficient (because no
optimization is made, I am working on this), but this is more than
enough if you have a reasonable amount of data (less than millions of
rows !!!).
Use the following code, and you should have what you need :

from cube.models import Cube

class SalesCube(Cube):

month = Dimension('date_created__absmonth',
queryset=Sale.objects.filter(date_created__range=(init_date,ends_date)))

@staticmethod
def aggregation(queryset):
return queryset.count()

The advantage is that if you want to add more dimensions (type of sale/
place/month, etc ...), you can do it very easily.
Hope that helps, and don't hesitate to ask me if you can't have it
working (documentation is not very good yet).

On Oct 29, 12:54 am, Mikhail Korobov  wrote:
> Hi Rogério,
>
> You can givehttp://bitbucket.org/kmike/django-qsstats-magic/srca
> try.
> It currently have efficient aggregate lookups (1 query for the whole
> time series) only for mysql but it'll be great if someone contribute
> efficient lookups for other databases :)
>
> On 28 окт, 19:31, Rogério Carrasqueira
>
>  wrote:
> > Hello!
>
> > I'm having an issue to make complex queries in django. My problem is, I have
> > a model where I have the sales and I need to make a report showing the sales
> > amount per month, by the way I made this query:
>
> > init_date = datetime.date(datetime.now()-timedelta(days=365))
> > ends_date = datetime.date(datetime.now())
> > sales =
> > Sale.objects.filter(date_created__range=(init_date,ends_date)).values(date_ 
> > created__month).aggregate(total_sales=Sum('total_value'))
>
> > At the first line I get the today's date past one year
> > after this I got the today date
>
> > at sales I'm trying to between a range get the sales amount grouped by
> > month, but unfortunatelly I was unhappy on this, because this error
> > appeared:
>
> > global name 'date_created__month' is not defined
>
> > At date_created is the field where I store the information about when the
> > sale was done., the __moth was a tentative to group by this by month.
>
> > So, my question: how to do that thing without using a raw sql query and not
> > touching on database independence?
>
> > Thanks so much!
>
> > Rogério Carrasqueira
>
> > ---
> > e-mail: rogerio.carrasque...@gmail.com
> > skype: rgcarrasqueira
> > MSN: rcarrasque...@hotmail.com
> > ICQ: 50525616
> > Tel.: (11) 7805-0074
>
>

-- 
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: Import csv file in admin

2010-10-29 Thread Jirka Vejrazka
I must still be missing something here. If all you want to do is to
read CSV file and save the data in the database, I still don't
understand why you use the forms machinery.

You only *need* to use the data model, e.g.

from myapp.models import Data

csvfile = csv.reader('something.csv')

for line in csvfile:
  do_necessary_data_conversions_or_checks(line)
  try:
Data.objects.create(field1=line[0], field2=line[1], ...)
  except (IndexError, IntegrityError):
print 'Invalid line encountered:\n%s' % line

  What am I missing?

   Jirka

-- 
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: Converting Django to Desktop App? (Multiple Instances)

2010-10-29 Thread Mike Dewhirst

On 29/10/2010 6:33pm, Victor Hooi wrote:

Hi,

This is a bit of a strange scenario.

We have a simple Django application used to maintain a database of
newspaper/journal articles. We're extensively using the django-admin
as part of this app.

Currently, we're having issues getting a production environment with
Python provisioned (corporate environment, locked technology roadmap
etc.), however, we will have access to a Oracle database instance.

One possibility raised was that for each of the clients (fairly small,
under 5), we install a local instance of Django and Apache, which they
access with their browser, and each of these instances communicates
with a single Oracle DB instance.


That looks a bit 'under the radar' with regard to locked roadmap etc. 
Why not dig the pit a bit deeper and make your own server with Apache, 
Django and your Oracle db. Much cleaner than Apache/Django everywhere.


With only 5 users presumably all inside the perimeter you could set it 
up on a well endowed desktop machine. I would be tempted to put it all 
in a VirtualBox running Linux so there wouldn't be any Apache production 
disclaimers relating to Windows. I'm assuming corporate environment == 
Microsoft. Also, if a hole in the locked roadmap emerged in future you 
have a VM ready to roll.


My 2c

Mike


I know on the Rails side, there was a product by Joyent called
Slingshot (http://joyeur.com/2007/03/22/joyent-slingshot/), which
allegedly did something similar (packaged up a RoR app into a desktop
application).

Are there any particular issues we need to be aware of if we decided
to go down this path?

In particular, I wasn't sure how multiple instances of Django would
handle concurrency if they were communicating with a single database.
Any advice there?

Any other possible drawbacks/roadblocks?

Cheers,
Victor



--
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: Cherokee for home developing

2010-10-29 Thread Karim Gorjux
I have just one question. While I'm editing the source of the project,
to see the result I have always to restart the server or there is
another way?

-- 
K.
Blog Personale: http://www.karimblog.net

-- 
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.



Converting Django to Desktop App? (Multiple Instances)

2010-10-29 Thread Victor Hooi
Hi,

This is a bit of a strange scenario.

We have a simple Django application used to maintain a database of
newspaper/journal articles. We're extensively using the django-admin
as part of this app.

Currently, we're having issues getting a production environment with
Python provisioned (corporate environment, locked technology roadmap
etc.), however, we will have access to a Oracle database instance.

One possibility raised was that for each of the clients (fairly small,
under 5), we install a local instance of Django and Apache, which they
access with their browser, and each of these instances communicates
with a single Oracle DB instance.

I know on the Rails side, there was a product by Joyent called
Slingshot (http://joyeur.com/2007/03/22/joyent-slingshot/), which
allegedly did something similar (packaged up a RoR app into a desktop
application).

Are there any particular issues we need to be aware of if we decided
to go down this path?

In particular, I wasn't sure how multiple instances of Django would
handle concurrency if they were communicating with a single database.
Any advice there?

Any other possible drawbacks/roadblocks?

Cheers,
Victor

-- 
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.