Re: Python libraries for visualisations

2021-03-14 Thread Danny
You can use matplotlib library, encode the image in base64 and then show it 
in your html


I found this snippet of code works the same way with the way I usually do 
it.

https://stackoverflow.com/questions/52368870/display-matplotlib-image-on-html-page-using-django

If you are interested in a dynamic charts, you need to use JS library such 
as leaflet or D3.js

On Monday, March 15, 2021 at 11:50:18 AM UTC+7 geethanj...@gmail.com wrote:

> Hi..How to build a dashboard using django and python libraries for 
> creating visualisations?. Please let me know .Thanks in advance!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d76e7c6b-f9b2-4988-b27c-2e399cb2f072n%40googlegroups.com.


Re: Help needed

2021-02-22 Thread Danny
Maybe it is not related to the model definition, but rather the .save() 
object?

On Tuesday, February 23, 2021 at 1:52:04 PM UTC+7 bhurk...@gmail.com wrote:

> I have done all these codes but it is saving only the current date .
> Any other method 
> *Regard,*
> *Neha Bhurke*
>
> *Precise Industrial Solutions Private Limited*
>
> Mob: +91 7738946067 <+91%2077389%2046067> I O: +91 22 28943214 
> <+91%2022%202894%203214>
>
> Add: 115, 1st Floor, Hari Om Plaza, Behind Omkareshwar Mandir, Near 
> National Park, Borivali (E), Mumbai-400066
>
>
>
> On Tue, Feb 23, 2021 at 12:10 PM Omkar Parab  wrote:
>
>> datetime=models.DateTimeField(auto_now=False) ?
>> Or remove "auto_now"
>> datetime=models.DateTimeField()
>>
>> On Tue, Feb 23, 2021, 11:34 AM neha bhurke  wrote:
>>
>>> Hello everyone,
>>>
>>> I am trying to select the custom date but 
>>> datetime=models.DateTimeField(auto_now=True)
>>> is only taking current date 
>>> Please help me 
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/b1c53101-c7c6-403f-9b43-6713d7f66c07n%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAJY8mfxi-bxtyMVWiOWCESK969Ok6nZaoyhWNSLvFO_0tEGp1Q%40mail.gmail.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c98c61c4-f767-4917-88e2-aed03c91c7can%40googlegroups.com.


Re: deployment error : django + pgsql

2020-12-29 Thread Danny Gho
Can you describe the error? Is there any error message you are getting?


Make sure that your pgsql port is open to local network/your Django server
connection.

Sincerely yours,




Danny Gho
dannygho.com

On Tue, Dec 29, 2020, 21:43 Govind Kumar Yadav  wrote:

> hi I have been trying to deploy my Django project with pgsql on Linux with
> over nginx server but i am not able to migrate for my already existing
> project which works fine in my windows machine.
> Help me to get over the issues.
> regards ,
> Govind
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFWZkWTp6fURth4vMgJKuQTy2D2QU1it5ptR3B6%3D7-MMGz0KQg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFWZkWTp6fURth4vMgJKuQTy2D2QU1it5ptR3B6%3D7-MMGz0KQg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DTpsQLfbt5vY0s5PwNg8DCpg7MyZX%3DRX7UWO-%3DRryj1U9b%3Dw%40mail.gmail.com.


Good stand alone blog app for django 3.0 >

2020-03-14 Thread Danny Blaker
Hi! I've been testing a few good blog apps (Pinax, Pupet/Wagtail - 
https://github.com/APSL/puput) etc - how ever they are currently only 
available for django 2. 
Does any one know a similar blog app that is django 3 compatible? I have 
been looking to no avail. Many Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1aa9ea01-d378-476e-a164-4781039ab599%40googlegroups.com.


pass a variable from another site to your django site

2019-06-08 Thread Danny Blaker
Scenario: You have built a chat bot (RASA-NLU for chat page + django for 
the rest of the site) that helps people with advice on gardening products. 
A major gardening retailer has approached you and asked if you could put a 
button on their product detail view pages, so that when a user clicks it, 
it re-directs to the chat bot page on your website and automatically passes 
the product text to the chat bot to begin the dialogue.
How would you approach this?

we were considering a solution using django API and AJAX, that involves 
adding jquery to their site and its a bit intrusive. 
we could use an iframe - then ofcourse you get the issues of iframes - 
responsiveness, security etc

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c319ddc3-41dc-45f5-8e2b-fc28e9d0d9b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django compressor issue - media assets from the forms.py won't update in the frontend django template

2019-05-25 Thread Danny Blaker
We are currently experiencing an issue with the Django compressor: We have 
an app that has forms.py and its media assets from the forms.py won't 
update in the frontend django template (only stuff inside the django 
compress tag won't update). This problem came about when we initially 
included external files in the static files media asset in forms.py, but 
that lead to problems with django compressor not being able to compress and 
access via our Cloudfront CDN. We changed that and now, it's stuck there, 
meaning it won't refresh with our newer local static files (we changed 
external file links to local static in the Media class inside forms.py). We 
have flushed our Redis node, done cloudfront invalidations, compressed 
again, collectstatic, terminated and started new instance within 
elasticbeanstalk. Has anyone had experience a similar issue and / or has 
any solutions? Many Thanks!!

Our architecture:
Elasticbeanstalk. (amazon's linux ec2 instance, python)
RDS (postgres database)
Elasticache (Redis)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e7c32975-a0d8-4254-bbaf-42d502b9a47b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Generate PDF using reportlab and write to s3 bucket without saving locally

2019-04-22 Thread Danny Blaker
I'm trying to generate a PDF using reportlab and write to s3 bucket without 
saving locally

I know I'm missing something simple:

# create a stream
stream = io.BytesIO()

# generate PDF
doc = SimpleDocTemplate(stream, pagesize=letter,
rightMargin=72, leftMargin=72,
topMargin=72, bottomMargin=18)
Story = []

styles = getSampleStyleSheet()

Story.append(Paragraph('This is a PDF', 
styles["Normal"]))

doc.build(Story)

# get buffer
pdf_buffer = stream.getbuffer()

filename = "new.pdf"
bucket_name = 'insert_bucket_name'
object_name = bucket_name

# here is where I get stuck - how should be passing the pdf_buffer to s3?

# how you typically write to s3 :
# Method 1

s3 = boto3.client('s3')
with open(filename, "rb") as f:
s3.upload_fileobj(f, bucket_name, object_name)

# Method 2
s3.Bucket(bucket_name).put_object(Key=filename, Body=file)

Any ideas most appreciated!

Thanks!

here are some related resources:

https://stackoverflow.com/questions/43373006/django-reportlab-save-generated-pdf-directly-to-filefield-in-aws-s3
https://sciwiki.fredhutch.org/compdemos/aws-python/#about-pandas-and-dask
https://stackoverflow.com/questions/12570465/how-to-upload-a-file-to-s3-without-creating-a-temporary-local-file

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/aea27da8-0c37-4e4e-9f0a-929ca85e34bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django + PostgreSQL Installation (pipenv install psycopg2)

2019-04-10 Thread Danny Blaker
https://github.com/psycopg/psycopg2/issues/699

Try updating pip too :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d5dc9dad-b20e-4e8e-961b-5e1447d5c84e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django + PostgreSQL Installation (pipenv install psycopg2)

2019-04-10 Thread Danny Blaker
https://www.google.com/url?sa=t=web=j=https://stackoverflow.com/questions/11618898/pg-config-executable-not-found=2ahUKEwitxePlncfhAhVDwIsBHeQbBTEQjjgwAHoECAkQAg=AOvVaw1ujp9GSEZRKKrkOSHWdMiD

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/170737dc-0cbf-4f5c-80e9-aa2c062e216c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: best way to generate PDFs in django - handling concurrency

2018-12-28 Thread Danny Blaker
Great. Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bc336d88-c70f-42af-aa6e-87e40c6ca12e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: best way to generate PDFs in django - handling concurrency

2018-12-27 Thread Danny Blaker
Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e8ef92bf-19c7-4881-9465-a04749cfad00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how can I work with multi model forms

2018-12-27 Thread Danny Blaker
https://docs.djangoproject.com/en/2.1/topics/forms/modelforms/#inline-formsets

https://github.com/elo80ka/django-dynamic-formset/blob/master/docs/usage.rst
https://github.com/elo80ka/django-dynamic-formset/blob/master/INSTALL.rst

clone the above, then check the examples




On Wednesday, 26 December 2018 23:29:11 UTC+11, Tessnim Zrayga wrote:
>
> Hello everyone,
> I have this design: there's a firm, a firm can have multiple nodes. Each 
> node can have many scheduled actions. What I'm trying to do is to create a 
> template containing all informations about a firm and be able to create 
> multiple scheduled actions at a time, so this is what the template will 
> look like in the end:
>
> [image: jhg.png]
>
> Here is what I coded: in models.py:
>
>
> class Node(models.Model):
> ID = models.DecimalField(max_digits=19, decimal_places=10)
> name = models.CharField(default='node', max_length=32)
> nb_solenoid = models.DecimalField(max_digits=19, decimal_places=10, 
> null=True, blank=True)
> connexion = models.CharField(max_length=255)
> status = models.BooleanField(default=False)
>
>
> class Firm(models.Model):
>
> name = models.CharField(max_length=32)
> address = models.CharField(max_length=32)
>
>
> class ScheduledAction(models.Model):
> date = models.DateTimeField(default=datetime.now, blank=True)
> firm = models.ForeignKey('Firm', on_delete=models.CASCADE, null=True, 
> blank=True)
> node = models.ForeignKey('Node', on_delete=models.CASCADE, null=True, 
> blank=True)
>
>
> views.py:
>
> def planification_view(request, id):
> obj = Firm.objects.get(id=id)
> form = ScheduledActionForm(request.POST or None)
> form1 = ScheduledActionForm(request.POST or None)
> form2 = FirmForm(request.POST or None)
> if form1.is_valid() and form2.is_valid():
> #form.save()
> print(type(form))
> print(form)
> context = {
> 'object': obj,
> 'form': form
> }
> return render(request, "node/planification.html", context)
>
>
> planification.html:
>
> 
> function submitForms(){
> document.forms["form1"].submit();
> document.forms["form2"].submit();
> }
> 
> 
> {{ object }}
> Firm: {{ object.name }}
> 
> 
> {% csrf_token %}
> {% for instance in object.node_set.all %}
>  {{ instance.name }}
> {% endfor %}
> 
> 
> 
> Planification
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
> 
> 
> Scheduled Actions
> {% for instance in object.scheduledaction_set.all %}
> {{instance.date}} - {{ instance.node }}
> {% endfor %}
> 
>
>
> But I can't go further and this code doesn't seem to work. I can check 
> nodes and click submit but nothing is stored in the database.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dc7287a1-0dfc-4bed-be96-0f2503e028e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error while running local server

2018-12-27 Thread Danny Blaker
run pip freeze in terminal and make sure its installed in your virtual env

On Friday, 28 December 2018 01:25:15 UTC+11, Shekhar Nunia wrote:
>
> Two days ago my project was working properly but now when I start my 
> project I get this error and I'm not able to figure out what the problem 
> is, if anyone able to understand this kindly suggests any solution.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ec6b9cb4-a80e-48e0-aef4-c1c8940ff791%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: DJANGO FOR FINANCE !

2018-12-27 Thread Danny Blaker
depending on processing time for formulars, you might want to consider a 
broker setup 
: https://realpython.com/asynchronous-tasks-with-django-and-celery/
if processing time is negligible then no need

On Saturday, 22 December 2018 07:29:20 UTC+11, Mohamed Hashi wrote:
>
> i have a problem with models 
> i write the code
> but still dont wanna makemigrartions 
> any help 
> thanks . 
>
> ‫في الجمعة، 14 ديسمبر 2018 في 3:33 ص تمت كتابة ما يلي بواسطة ‪codesign web 
> za‬‏ <‪sh...@codesign.web.za ‬‏>:‬
>
>> I eventually chose django-chartjs and django-datatable for this
>>
>> On 13/12/2018 19:55, carlos wrote:
>>
>> yes, is posible in Django make forms for input user and output make grahp 
>> and table 
>>
>> Cheers
>>
>> On Thu, Dec 13, 2018 at 9:35 AM Mamoudou Diallo > > wrote:
>>
>>> Hey EVERYONE ! 
>>>
>>> I am working on a project where I am would like to use django to build a 
>>> site that computes certain financial formulas based on user inputs or even 
>>> better (based on Time series data set) and spits out the results in a form 
>>> of a graph or predisgned table. I have the formulas written out in python 
>>> already, but I am new to django, but I have watched a few tutorial videos 
>>> and how powerful it is. Most of the tutorials and content that I have come 
>>> accross with is primarily not related to finance but mouch more towads 
>>> building blog posts etc
>>>
>>>
>>> Please checkout the attachement for a picture view of what I want to do. 
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com 
>>> .
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/bddac915-325e-4a1c-af18-4c4b8ef39993%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> -- 
>> att. 
>> Carlos Rocha
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAM-7rO2Csx2bMZBO%3DfHzSxdEwbxfkdmZFsfh4mmOnQFu1JzWGw%40mail.gmail.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/4000facf-e1cb-3aef-91cf-c33290f1bf9a%40codesign.web.za
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1c2f61a7-49b0-4135-8977-ec833a41dc3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


best way to generate PDFs in django - handling concurrency

2018-12-27 Thread Danny Blaker
we're building an app for the council where users fill in a form, then we 
generate a PDF (containing a page of text), and users get a download link 
on the homepage. 
we expect many users to submit forms concurrently.

I see 2 approaches:

1. Generate in the view as per documentation 
: https://docs.djangoproject.com/en/2.1/howto/outputting-pdf/
2. Use a seperate script to generate PDF and use django 
api https://www.django-rest-framework.org/api-guide/parsers/#fileuploadparser

However, to handle concurrency we'll also need a broker - like rabbitMQ + 
Celery

Is there a "best practice" way to approach this, or has anyone had 
experience with generating PDFs in django and can recommend an approach?

Thanks!!

resources:

https://realpython.com/asynchronous-tasks-with-django-and-celery/
https://simpleisbetterthancomplex.com/tutorial/2017/08/20/how-to-use-celery-with-django.html#why-should-i-use-celery


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9f06d9aa-7d89-4700-8cd0-9ae3343b3128%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


dynamic form and model instances - what is the best method?

2018-12-18 Thread Danny Blaker
Hi! I hope the following will help future django developers.

Scenario:

We need a form that allows the user to *add *and *remove* referees from a 
resume:  see (rough) snippet below:

(using materializecss)

  

  
  Reference Name


  
  Current Position


   clear   

  

 

  
add
  

 

We have a resume model, and referees model with a many-to-many relationship 
like so:

class Resume(models.Model):
first_name = models.CharField(max_length=250)
last_name = models.CharField(max_length=250)
...


class Referees(models.Model):
resume = models.ForiegnKey(Resume, on_delete=CASCADE)
name = models.CharField(max_length=250)
position = models.CharField(max_length=250)


What is the best way to achieve this?


questions:


   - I'm assuming when user hits 'add', we'll need to clone a copy of the 
   two input fields ('reference name' and 'current position'), and append it 
   to the form? is using the java-script clone method best practice?
   - Is it best to create a new instance of the referee model each time a 
   user hits "add", or create them all at once when the submit the form. (hit 
   save)
   - When the user returns to edit view, the form will need to repopulate 
   with all the new referees they added - what would be the best way to do 
   this?

Note we're not using react or angular. Just pain old html / js / ajax.

All advice, solutions, suggestions most appreciated.

Cheers!





-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fcf35a60-b55d-4967-b2e0-68c8cf7dde5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Installing Django

2017-01-30 Thread Danny Jr Chu
Ok, thanks.

On Monday, January 30, 2017 at 8:39:29 PM UTC+8, Antonis Christofides wrote:
>
> If you want to build something like Upwork, then Django is definitely a 
> good option, but of course, as you have guessed, you have really much 
> learning to do.
>
> Regards,
>
> Antonis
>
> Antonis Christofideshttp://djangodeployment.com
>
>
> On 01/30/2017 02:27 PM, Danny Jr Chu wrote:
>
> I will consider your professional advise Antonis. However, what I would 
> like to build is a (1st) freelancer website (upwork or like), I know that 
> there are hundreds of these right now, but with a subtle twist and to offer 
> both client and contractor something more, it may be feasible. (2nd) I fail 
> to find Angel Investor so I have to cut cost everything to the rock bottom, 
> I have a lot of time available to study and (plus motivation of course) and 
> (3nd) I've done number of websites with blogspot (but plugins are paid 
> monthly). So, I was thinking to do it myself the backbone with Django. 
> Please tell me more what I should have know to bring this project to life. 
>
> Thanks for your support,
> Danny
>
> On Monday, January 30, 2017 at 6:54:58 PM UTC+8, Antonis Christofides 
> wrote: 
>>
>> If you want to just make a web site, Django is the wrong thing for you. 
>> Django is not for building web sites, it's for building web applications. 
>> You might instead want to look at Mezzanine or Django-CMS or Wagtail (these 
>> are all software for building web sites and they're based on Django), or, 
>> if being based on Django is not a requirement, you can use Wordpress or 
>> Drupal. There are really many more, there must be tens. I believe the most 
>> popular is Wordpress.
>>
>> If you use any of these and install it on a server, you will only need to 
>> pay for the domain and hosting (and spend considerable time setting it up).
>>
>> If you use wordpress.com, they set it up for you, so you don't need to 
>> install it yourself, and the cost is probably less than getting a virtual 
>> server to install stuff yourself.
>>
>> I don't want to discourage you from using Django if it's for you. I just 
>> don't want you to get the impression that "Django is 
>> bad/complicated/painful" when you just might be using it for the wrong 
>> purpose.
>>
>> Regards,
>>
>> Antonis
>>
>> Antonis Christofideshttp://djangodeployment.com
>>
>>
>> On 01/30/2017 12:33 PM, Danny Jr Chu wrote:
>>
>> Hi Antonis,  
>>
>> No I have not yet tried wordpress, but the answer is budget wise. I would 
>> think that after these exercises, I am just going to pay (I think) the 
>> domain and hosting only.
>>
>> Regards,
>> Danny
>>
>> On Monday, January 30, 2017 at 6:16:27 PM UTC+8, Antonis Christofides 
>> wrote: 
>>>
>>> I wish I could build a website out of my imaginary
>>>
>>> Hello,
>>>
>>> depending on what you mean with "build a website", you may be looking at 
>>> the wrong thing. Have you tried, for example, to build a web site at 
>>> wordpress.com? If yes, why is this not sufficient for you and you want 
>>> to learn Django?
>>>
>>> Regards,
>>>
>>> Antonis
>>>
>>> Antonis Christofideshttp://djangodeployment.com
>>>
>>>
>>> On 01/30/2017 05:05 AM, Danny Jr Chu wrote:
>>>
>>> Guys, please help. I am new with Python and Django, I mean I don't have 
>>> any clue what's going on (don't even know how to encode), but I wish I 
>>> could build a website out of my imaginary. I know this will goes miles and 
>>> miles... I am trying to install Django but couple of errors occur :  
>>>
>>> PS C:\Users\Luv> easy_install django
>>> Searching for django
>>> Reading https://pypi.python.org/simple/django/
>>> Downloading 
>>> https://pypi.python.org/packages/c3/c2/6096bf5d0caa4e3d5b985ac72e3a0c795e37fa7407d6c85460b2a105b467/Django-1
>>> .10.5.tar.gz#md5=3fce02f1e6461fec21f1f15ea7489924
>>> Best match: Django 1.10.5
>>> Processing Django-1.10.5.tar.gz
>>> Writing 
>>> C:\Users\Luv\AppData\Local\Temp\easy_install-5dcbu64l\Django-1.10.5\setup.cfg
>>> Running Django-1.10.5\setup.py -q bdist_egg --dist-dir 
>>> C:\Users\Luv\AppData\Local\Temp\easy_install-5dcbu64l\Django-1.10
>>> .5\egg-dist-tmp-k4dzxio3
>>> no previously-included directories found matching 
>>> 'django\contrib\admin\bin'
>>> warning: no previously-included files matching '__pycache

Re: Installing Django

2017-01-30 Thread Danny Jr Chu
I will consider your professional advise Antonis. However, what I would 
like to build is a (1st) freelancer website (upwork or like), I know that 
there are hundreds of these right now, but with a subtle twist and to offer 
both client and contractor something more, it may be feasible. (2nd) I fail 
to find Angel Investor so I have to cut cost everything to the rock bottom, 
I have a lot of time available to study and (plus motivation of course) and 
(3nd) I've done number of websites with blogspot (but plugins are paid 
monthly). So, I was thinking to do it myself the backbone with Django. 
Please tell me more what I should have know to bring this project to life. 

Thanks for your support,
Danny

On Monday, January 30, 2017 at 6:54:58 PM UTC+8, Antonis Christofides wrote:
>
> If you want to just make a web site, Django is the wrong thing for you. 
> Django is not for building web sites, it's for building web applications. 
> You might instead want to look at Mezzanine or Django-CMS or Wagtail (these 
> are all software for building web sites and they're based on Django), or, 
> if being based on Django is not a requirement, you can use Wordpress or 
> Drupal. There are really many more, there must be tens. I believe the most 
> popular is Wordpress.
>
> If you use any of these and install it on a server, you will only need to 
> pay for the domain and hosting (and spend considerable time setting it up).
>
> If you use wordpress.com, they set it up for you, so you don't need to 
> install it yourself, and the cost is probably less than getting a virtual 
> server to install stuff yourself.
>
> I don't want to discourage you from using Django if it's for you. I just 
> don't want you to get the impression that "Django is 
> bad/complicated/painful" when you just might be using it for the wrong 
> purpose.
>
> Regards,
>
> Antonis
>
> Antonis Christofideshttp://djangodeployment.com
>
>
> On 01/30/2017 12:33 PM, Danny Jr Chu wrote:
>
> Hi Antonis,  
>
> No I have not yet tried wordpress, but the answer is budget wise. I would 
> think that after these exercises, I am just going to pay (I think) the 
> domain and hosting only.
>
> Regards,
> Danny
>
> On Monday, January 30, 2017 at 6:16:27 PM UTC+8, Antonis Christofides 
> wrote: 
>>
>> I wish I could build a website out of my imaginary
>>
>> Hello,
>>
>> depending on what you mean with "build a website", you may be looking at 
>> the wrong thing. Have you tried, for example, to build a web site at 
>> wordpress.com? If yes, why is this not sufficient for you and you want 
>> to learn Django?
>>
>> Regards,
>>
>> Antonis
>>
>> Antonis Christofideshttp://djangodeployment.com
>>
>>
>> On 01/30/2017 05:05 AM, Danny Jr Chu wrote:
>>
>> Guys, please help. I am new with Python and Django, I mean I don't have 
>> any clue what's going on (don't even know how to encode), but I wish I 
>> could build a website out of my imaginary. I know this will goes miles and 
>> miles... I am trying to install Django but couple of errors occur :  
>>
>> PS C:\Users\Luv> easy_install django
>> Searching for django
>> Reading https://pypi.python.org/simple/django/
>> Downloading 
>> https://pypi.python.org/packages/c3/c2/6096bf5d0caa4e3d5b985ac72e3a0c795e37fa7407d6c85460b2a105b467/Django-1
>> .10.5.tar.gz#md5=3fce02f1e6461fec21f1f15ea7489924
>> Best match: Django 1.10.5
>> Processing Django-1.10.5.tar.gz
>> Writing 
>> C:\Users\Luv\AppData\Local\Temp\easy_install-5dcbu64l\Django-1.10.5\setup.cfg
>> Running Django-1.10.5\setup.py -q bdist_egg --dist-dir 
>> C:\Users\Luv\AppData\Local\Temp\easy_install-5dcbu64l\Django-1.10
>> .5\egg-dist-tmp-k4dzxio3
>> no previously-included directories found matching 
>> 'django\contrib\admin\bin'
>> warning: no previously-included files matching '__pycache__' found 
>> anywhere in distribution
>> creating c:\program files (x86)\lib\site-packages\django-1.10.5-py3.6.egg
>> Extracting django-1.10.5-py3.6.egg to c:\program files 
>> (x86)\lib\site-packages
>> Adding django 1.10.5 to easy-install.pth file
>> Installing django-admin.py script to c:\program files (x86)\Scripts
>> error: [Errno 13] Permission denied: 'c:\\program files 
>> (x86)\\Scripts\\django-admin.py'
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com

Re: Installing Django

2017-01-30 Thread Danny Jr Chu
Hi Antonis, 

No I have not yet tried wordpress, but the answer is budget wise. I would 
think that after these exercises, I am just going to pay (I think) the 
domain and hosting only.

Regards,
Danny

On Monday, January 30, 2017 at 6:16:27 PM UTC+8, Antonis Christofides wrote:
>
> I wish I could build a website out of my imaginary
>
> Hello,
>
> depending on what you mean with "build a website", you may be looking at 
> the wrong thing. Have you tried, for example, to build a web site at 
> wordpress.com? If yes, why is this not sufficient for you and you want to 
> learn Django?
>
> Regards,
>
> Antonis
>
> Antonis Christofideshttp://djangodeployment.com
>
>
> On 01/30/2017 05:05 AM, Danny Jr Chu wrote:
>
> Guys, please help. I am new with Python and Django, I mean I don't have 
> any clue what's going on (don't even know how to encode), but I wish I 
> could build a website out of my imaginary. I know this will goes miles and 
> miles... I am trying to install Django but couple of errors occur :  
>
> PS C:\Users\Luv> easy_install django
> Searching for django
> Reading https://pypi.python.org/simple/django/
> Downloading 
> https://pypi.python.org/packages/c3/c2/6096bf5d0caa4e3d5b985ac72e3a0c795e37fa7407d6c85460b2a105b467/Django-1
> .10.5.tar.gz#md5=3fce02f1e6461fec21f1f15ea7489924
> Best match: Django 1.10.5
> Processing Django-1.10.5.tar.gz
> Writing 
> C:\Users\Luv\AppData\Local\Temp\easy_install-5dcbu64l\Django-1.10.5\setup.cfg
> Running Django-1.10.5\setup.py -q bdist_egg --dist-dir 
> C:\Users\Luv\AppData\Local\Temp\easy_install-5dcbu64l\Django-1.10
> .5\egg-dist-tmp-k4dzxio3
> no previously-included directories found matching 
> 'django\contrib\admin\bin'
> warning: no previously-included files matching '__pycache__' found 
> anywhere in distribution
> creating c:\program files (x86)\lib\site-packages\django-1.10.5-py3.6.egg
> Extracting django-1.10.5-py3.6.egg to c:\program files 
> (x86)\lib\site-packages
> Adding django 1.10.5 to easy-install.pth file
> Installing django-admin.py script to c:\program files (x86)\Scripts
> error: [Errno 13] Permission denied: 'c:\\program files 
> (x86)\\Scripts\\django-admin.py'
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/86091d59-6578-4e85-9be0-d24beb1f5b84%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/86091d59-6578-4e85-9be0-d24beb1f5b84%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6cafee05-1c3f-40cf-aeab-00f98493cf6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Installing Django

2017-01-30 Thread Danny Jr Chu
Hello Jani, you are an angel :) 

I have un-installed it and re-install to the right folder.. thanks a lot. 

On Monday, January 30, 2017 at 4:34:27 PM UTC+8, Jani Tiainen wrote:
>
> Hi,
>
> First you seem to be installing Django to Windows, it adds certain 
> complexity all together, it's not impossible though.
>
> By given paths for some strange reason easy_install seems to thing that 
> you have installed your Python to "C:\program files (x86)\" directory (not 
> subdirectory there or anything, to root of that folder), that is quite 
> wrong, first it requires allways adminstrative access to install anything 
> there, and second it's not standard place, which would be something like 
> C:\PythonXX\ (to avoid permission problems). 
>
> First thing to you is now to figure out did you managed to mess up Python 
> installation by putting it to incorrect path and fix by removing all 
> components and then installing it to more proper location. 
>
> Depending on Python modules you want to use some may require compiling 
> which is not simple under Windows, so if you can use some Linux (or some 
> other unix variant) box or something like virtual machine setting up 
> environment is much easier.
>
> On 30.01.2017 05:05, Danny Jr Chu wrote:
>
> Guys, please help. I am new with Python and Django, I mean I don't have 
> any clue what's going on (don't even know how to encode), but I wish I 
> could build a website out of my imaginary. I know this will goes miles and 
> miles... I am trying to install Django but couple of errors occur :  
>
> PS C:\Users\Luv> easy_install django
> Searching for django
> Reading https://pypi.python.org/simple/django/
> Downloading 
> https://pypi.python.org/packages/c3/c2/6096bf5d0caa4e3d5b985ac72e3a0c795e37fa7407d6c85460b2a105b467/Django-1
> .10.5.tar.gz#md5=3fce02f1e6461fec21f1f15ea7489924
> Best match: Django 1.10.5
> Processing Django-1.10.5.tar.gz
> Writing 
> C:\Users\Luv\AppData\Local\Temp\easy_install-5dcbu64l\Django-1.10.5\setup.cfg
> Running Django-1.10.5\setup.py -q bdist_egg --dist-dir 
> C:\Users\Luv\AppData\Local\Temp\easy_install-5dcbu64l\Django-1.10
> .5\egg-dist-tmp-k4dzxio3
> no previously-included directories found matching 
> 'django\contrib\admin\bin'
> warning: no previously-included files matching '__pycache__' found 
> anywhere in distribution
> creating c:\program files (x86)\lib\site-packages\django-1.10.5-py3.6.egg
> Extracting django-1.10.5-py3.6.egg to c:\program files 
> (x86)\lib\site-packages
> Adding django 1.10.5 to easy-install.pth file
> Installing django-admin.py script to c:\program files (x86)\Scripts
> error: [Errno 13] Permission denied: 'c:\\program files 
> (x86)\\Scripts\\django-admin.py'
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> <https://groups.google.com/d/msgid/django-users/86091d59-6578-4e85-9be0-d24beb1f5b84%40googlegroups.com?utm_medium=email_source=footer>
> https://groups.google.com/d/msgid/django-users/86091d59-6578-4e85-9be0-d24beb1f5b84%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> Jani Tiainen
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d0938a27-8246-4b9d-9a16-b5c7919349f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Installing Django

2017-01-29 Thread Danny Jr Chu
Guys, please help. I am new with Python and Django, I mean I don't have any 
clue what's going on (don't even know how to encode), but I wish I could 
build a website out of my imaginary. I know this will goes miles and 
miles... I am trying to install Django but couple of errors occur : 

PS C:\Users\Luv> easy_install django
Searching for django
Reading https://pypi.python.org/simple/django/
Downloading 
https://pypi.python.org/packages/c3/c2/6096bf5d0caa4e3d5b985ac72e3a0c795e37fa7407d6c85460b2a105b467/Django-1
.10.5.tar.gz#md5=3fce02f1e6461fec21f1f15ea7489924
Best match: Django 1.10.5
Processing Django-1.10.5.tar.gz
Writing 
C:\Users\Luv\AppData\Local\Temp\easy_install-5dcbu64l\Django-1.10.5\setup.cfg
Running Django-1.10.5\setup.py -q bdist_egg --dist-dir 
C:\Users\Luv\AppData\Local\Temp\easy_install-5dcbu64l\Django-1.10
.5\egg-dist-tmp-k4dzxio3
no previously-included directories found matching 'django\contrib\admin\bin'
warning: no previously-included files matching '__pycache__' found anywhere 
in distribution
creating c:\program files (x86)\lib\site-packages\django-1.10.5-py3.6.egg
Extracting django-1.10.5-py3.6.egg to c:\program files 
(x86)\lib\site-packages
Adding django 1.10.5 to easy-install.pth file
Installing django-admin.py script to c:\program files (x86)\Scripts
error: [Errno 13] Permission denied: 'c:\\program files 
(x86)\\Scripts\\django-admin.py'

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/86091d59-6578-4e85-9be0-d24beb1f5b84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Getting unexpected results when using multiple aggregates

2016-05-13 Thread danny
I'm using an aggregate query to gather some information and I'm getting 
unexpected results.

>>> show_assets.aggregate(media_size=Sum('assetmedia__size')){'media_size': 
652475}>>> show_assets.aggregate(assets_size=Sum('size'), 
media_size=Sum('assetmedia__size'),thumb_size=Sum('assetthumb__size')){'assets_size':
 
17488245, 'media_size': 47630675, 'thumb_size': 582827}
Notice the difference in the "media_size" result when doing multiple 
aggregates. Is this the intended result or a bug?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7023cade-2346-49e3-8db8-1359c9c77ceb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


broken imports in python3.3 + django 1.5

2013-04-26 Thread danny
Howdy,

In python 3.3 you no longer need __init__.py in directories to be
interpreted as package namespaces. In my source I have the following tree
src
  /apps
/index
/mapping

I removed the __init__.py files as I should be able to, but imports broke.
Specifically:

 
/opt/python3.3.1/lib/python3.3/site-packages/django/utils/translation/trans_real.py(155)_fetch()
154 app = import_module(appname)
2-> 155 apppath =
os.path.join(os.path.dirname(upath(app.__file__)), 'locale')

notice the app.__file__. In python 3.3 modules are not required to have a
__file__ attribute. 

So in particular, I was not able to execute
python3.3 manage.py shell because of the cryptic
*** AttributeError: 'module' object has no attribute '__file__'
which I traced to this line in the Django source.

I don't know if it appears anywhere else, but module.__file__ is no longer
robust in python 3.3.

The poor man's fix is to put the __init__.py's back in. 
src
  /apps
/index
  __init__.py
/mapping
  __init__.py

works just fine, but shouldn't be required.

This is on RHEL5.8, but I doubt that matters.

thanks,
Danny


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Geodjango on Windows issue

2012-08-07 Thread Danny Im
Hello all, 

I'm hoping to get some assistance on this.

Issue:
A user can upload a shapefile to the django application once upon a fresh 
apache restart.  Any subsequent shapefile upload by any other user results in 
the server not giving any response back to the client.  Other uploads go 
through fine.  Shapefile uploads make use of GDAL (in particular, the code will 
hang on a call to OGRGeometry.transform), other uploads do not.  

What I think is happening:
A python thread will hang whenever a user uploads a shapefile (and thus calling 
a GDAL library function), given that another thread has previously used a GDAL 
function.  

What I've done so far:
>From the geodjango documentation 
>(https://docs.djangoproject.com/en/1.4/ref/contrib/gis/deployment/), no 
>threading should be used for webserver deployment as GDAL is not thread safe.  
>However, since I'm using apache on windows, it appears that the mpm used 
>creates multiple threads for each request
http://httpd.apache.org/docs/2.2/mod/mpm_winnt.html

My question:  Is there any way to use apache on windows for geodjango 
applications?  I'm assuming my problem will be solved if I can have each 
request be handled by a separate process - are there any other webservers that 
I should look into?  I'd prefer solutions that would work on Windows.

Relevant software used: 
Windows Server 2008 R2
Apache HTTP Server version 2.2.22
GDAL/OGR 1.9.1
Django 1.4
MapServer CGI 6.0.3

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/3MCkF0uQZM4J.
To post to this group, send email to django-users@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.



"Current" timezone in admin

2012-01-12 Thread Danny W. Adair
Hi,
With 1.4 timezone support I was wondering if/how django admin supports
the current user's timezone.
There's no corresponding HTTP header like "Accept-Language" so I guess
the timezone must be set in the session (looked up from a profile or
whatever).

Is there a hook that allows the "current" timezone to be set for
admin, so that it uses it for datetime display/submission? Maybe a
middleware that expects a session variable configured/named in
settings?

With full timezone support I also think it may be worth adding
timezone to the standard User model, with a default None that falls
back to settings.TIME_ZONE

Cheers,
Danny

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: new at this -- need some guidance

2011-09-10 Thread Danny Gale
Daniel, thank you very much. That's extremely helpful. 

What I'm trying to define is that every song can be on one album, but each 
album can (of course) have many songs. For that, would it be better to use 
the ManyToMany from Album to song or FK from song to album?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/xQ5cLEmcdlAJ.
To post to this group, send email to django-users@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 at this -- need some guidance

2011-09-09 Thread Danny Gale
Hi, I'm learning Django (albeit slowly) and I'm trying to set up a really 
simple database. I want to have Artists, Albums, and Tracks. I want to be 
able to navigate both ways in the db. So you should be able to go from 
artist -> album or from album -> artist. Same thing with album and track. I 
really can't figure it out. Here's the simplest test case I can come up 
with:

class Song(models.Model):
album   = models.ForeignKey('Album')

class Album(models.Model):
tracks  = models.ManyToManyField(Song)

when i run syncdb, it comes up with the following error:
music.album: Reverse query name for m2m field 'tracks' clashes with field 
'Song.album'. Add a related_name argument to the definition for 'tracks'.

So I go back and add the related_name argument:
class Song(models.Model):
album   = models.ForeignKey('Album')

class Album(models.Model):
tracks  = models.ManyToManyField(Song, related_name='album')

and run syncdb again:
music.album: Accessor for m2m field 'tracks' clashes with field 
'Song.album'. Add a related_name argument to the definition for 'tracks'.
music.album: Reverse query name for m2m field 'tracks' clashes with field 
'Song.album'. Add a related_name argument to the definition for 'tracks'.

uh oh. Now there's *TWO* errors!!! What am I doing wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/1i5-cwJxoqAJ.
To post to this group, send email to django-users@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.



App namespace/packages?

2011-08-30 Thread Danny W. Adair
Hi,
There are "reusable" apps which provide functionality in a variety of
contexts.
However, some apps only make sense (because of dependencies) in the
context of one or more other apps.
For example, I have a relatively big piece of software consisting of
(like a good boy) multiple apps, which work together.
Some are "core apps", some are optional "plugin apps". The latter
could be installed and used, but really only when the core apps are
present.
Nevertheless, they sit on that same top-level namespace together with
all the other "really reusable" apps.

I think a shop system is a good example, and looking at satchmo I saw
apps called "satchmo_this" and "satchmo_that".
I'd rather see such apps packaged up so it's clear where they belong
to.

Before posting a feature request on the issue tracker I thought I'd
ask how other people deal with this situation?
I'd love if all apps were in a directory "apps", and the various
loaders allowed me to go another level.

Cheers,
Danny

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



trouble serving static content within an included javascript libary

2011-05-26 Thread Danny Shevitz
Howdy,

I'm pretty much a django newbie and can't figure out how to resolve the
following issue. I am hosting a local copy of the OpenLayers javascript library
and it's associated static content including .png's and .css's.

On my file system, the structure is:

mapping/static/openlayers.js
mapping/static/img/*.png
mapping/static/theme/...

Internal to OpenLayers, OpenLayers gets images and such using relative paths 
like "img/whatever.png" and "theme/default/style.css". Notice that these urls
are relative to OpenLayers.

Within Django, I am using staticfiles and staticfiles_urlpatterns for urls.

So within my web page template I can get to OpenLayers just fine via:


which resolves to:

http://localhost:8000/mapping/static/openlayers.js

The problem is that with OpenLayers, the resources referenced by
"img/whatever.png" are resolved into 

http://localhost:8000/mapping/img/whatever.png 

not 

http://localhost:8000/mapping/static/img/whatever.png 

where they would be found.

Is there an easy way to fix this? I don't want to move OpenLayers, and I really
don't want to have to edit OpenLayers.

thanks,
Danny


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



newbie question regarding passwords and service requests

2011-03-23 Thread Danny Shevitz
Howdy,

This is a newbie question on best practices of web design and django.

I have the following problem: Imagine my django app is wonderful and secure
and uses the auth module and all that. I need to run some other web service
provided by other developers in my company on another platform. Their
services are also secure with authorization and users and passwords...

The problem is the following. How do I access their services programmatically
without coding username, password in clear text?

In other words, how do I access their services in a secure way, so that if my
server is compromised, it doesn't compromise their server?

Is this possible?

thanks,
Danny

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: InterfaceError: Connection already closed -- is this a regression?

2011-03-15 Thread Danny
I'm having the exact same issue and haven't found any answers either.
I'll update if I find something as well.

On Mar 2, 11:46 am, onelson  wrote:
> I recently switched a project from mysql to postgres and started to
> see httpd throwing intermittent 500 errors.
>
> mod_wsgi (pid=26467): Exception occurred processing WSGI script '/
> htdocs/django.wsgi'.
>  Traceback (most recent call last):
>    File "./lib/python2.6/site-packages/django/core/handlers/
> wsgi.py", line 275, in __call__
>      signals.request_finished.send(sender=self.__class__)
>    File "./lib/python2.6/site-packages/django/dispatch/
> dispatcher.py", line 172, in send
>      response = receiver(signal=self, sender=sender, **named)
>    File "./lib/python2.6/site-packages/django/db/__init__.py",
> line 84, in close_connection
>      conn.close()
>    File "./lib/python2.6/site-packages/django/db/backends/
> __init__.py", line 79, in close
>      self.connection.close()
> InterfaceError: connection already closed
>
> I'm seeing this maybe every 20-30th page request.
>
> Looking at the issues on trac, I see a handful of tickets that share
> this error, however I don't see anything common between them (or my
> own situation) beyond using 
> psycopg2.http://code.djangoproject.com/search?q=InterfaceError+connection+alre...
> Most of the tickets are *old*. Years old. Either this is something pg
> users are familiar with and just know how to deal with, or this is a
> bug (or both?)
>
> Thoughts please!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Flatten template?

2011-01-11 Thread Danny Adair
Just in case someone needs this... I now have a working module.

It "resolves" via the source files - no context, no "real rendering".
Therefore only literal string parameters are supported for the
template paths of {% extends ... %} and {% include ... %}. That's ok
for my current purposes.
Otherwise I don't see any drawbacks, and it handles multiple
inheritance and nested blocks just fine.

If anyone ever runs across the problem of having to "flatten" django
templates, happy to provide the source
(130 lines incl. lots of comments, bit much for email)

The main issue I had to tackle were nested {% block ... %} across
inherited templates.
After
1. failing with regular expressions (they can't balance the opening
with their corresponding closing tags, for arbitrary levels of
nesting),
2. failing with pyparsing (I still think there could be an elegant
pyparsing solution, but blocks have different names - they're not just
nested parantheses - so nestedExpr() gets a little more complicated
here - I believe similar issue to
http://pyparsing.wikispaces.com/message/view/home/8771774).
3. failing with Node objects. They lose the original source ("origin")
unless TEMPLATE_DEBUG=True. I subclassed and forced the source to
always be kept, but realized that the source is not kept per node,
rather the complete source is kept (per ExtendsNode) together with
start and end index of where (just the opening of!) the tag was found.
4. the end result looks like a stripped down sgml parser - iterative
regex finding, cutting up, together with matching corresponding {%
endblock %}'s and some simple string replacements.

Cheers,
Danny


On Tue, Jan 11, 2011 at 10:51, Danny W. Adair <danny.ad...@unfold.co.nz> wrote:
> Hi,
> I need to get the template source of a template "after inheritance",
> i.e. render just the loader tags "include", "extends" and
> "block" (incl. variable block.super), so that I end up with one
> independent template which is otherwise unrendered.
>
> Has anyone done this before or has pointers?
>
> I'm still undecided whether to work with Node objects (maybe borrowing
> some ideas from http://djangosnippets.org/snippets/769/ ) or just use
> regex on the source and manually "glue together".
>
> Any help greatly appreciated.
>
> Cheers,
> Danny
>



-- 
Kind regards,

Danny W. Adair
Director
Unfold Limited
New Zealand

Talk:       +64 - 9 - 9555 101
Fax:        +64 - 9 - 9555 111
Write:      danny.ad...@unfold.co.nz
Browse:     www.unfold.co.nz
Visit/Post: 253 Paihia Road, RD 2, Kawakawa 0282, New Zealand

"We are what we repeatedly do. Excellence, then, is not an act but a habit."

==
Caution
The contents of this email and any attachments contain information
which is CONFIDENTIAL to the recipient. If you are not the intended
recipient, you must not read, use, distribute, copy or retain this
email or its attachments. If you have received this email in error,
please notify us immediately by return email or collect telephone call
and delete this email.  Thank you.  We do not accept any
responsibility for any changes made to this email or any attachment
after transmission from us.
==

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



Flatten template?

2011-01-10 Thread Danny W. Adair
Hi,
I need to get the template source of a template "after inheritance",
i.e. render just the loader tags "include", "extends" and
"block" (incl. variable block.super), so that I end up with one
independent template which is otherwise unrendered.

Has anyone done this before or has pointers?

I'm still undecided whether to work with Node objects (maybe borrowing
some ideas from http://djangosnippets.org/snippets/769/ ) or just use
regex on the source and manually "glue together".

Any help greatly appreciated.

Cheers,
Danny

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



iPhone posting FILEs = "Invalid content length"

2010-09-30 Thread Danny Bos

Hey there,
I've got a new error I'm totally stumped on. All searches are saying
it's a "http vs https" or similar.
I'd be keen to hear your thoughts.

Basically I've got an iPhone app sending a POST to a django app, it
contains one FILE.
Every now and then (very sporadically, about 1 in 5) one fails and I
get the below message.


Exception Type:
MultiPartParserError


Exception Value:
Invalid content length: 0


Exception Location:
/home/72999/data/python/django/django/http/multipartparser.py in
_init_, line 80


Any ideas?

-- 
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: iPhone talking to Django server (matching session)

2010-09-29 Thread Danny Bos

Thanks Skylar,
One more semi-related question for anyone keen, if the iPhone is
sending me a cookie with the session id in it, would I get it in a
similar way?

Eg:

session_key = request.COOKIES['session_id']
session = Session.objects.get(session_key=session_key)
uid = session.get_decoded().get('_auth_user_id')
user = User.objects.get(pk=uid)

Look right?
I think I'm just finding it hard to understand the two devices talking
to each other and having cookies together, I guess I'm a browser kind
of guy.


d.

On Sep 29, 1:25 pm, Skylar Saveland <skylar.savel...@gmail.com> wrote:
> User.objects.get(pk=Session.objects.get(pk=session_id).get_decoded()
> ['_auth_user_id']) via @SmileyChris
>
> On Sep 28, 9:36 pm, Danny Bos <da...@stateempire.com> wrote:
>
> > Heya,
>
> > I've got a Django application talking to an iPhone sending photos and
> > User data back and forth. I figured the best way to approach this
> > (tell me otherwise) was to log the user in on the server and pass the
> > iPhone back the 'session ID' in a JSON array.
>
> > Then when the iPhone sends me back some info, they send me that same
> > 'session ID' and I match that to the associated user content in order
> > to get the User details. Does this make sense? Is it the way to go in
> > order to pass User details back and forth to an iPhone.
>
> > If so.
>
> > How do I find the User when the iPhone passes me back the 'session
> > ID'?
>
> > Thanks in advance,
> > Hope all is well your side of town ...
>
> > d.

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



iPhone talking to Django server (matching session)

2010-09-28 Thread Danny Bos
Heya,

I've got a Django application talking to an iPhone sending photos and
User data back and forth. I figured the best way to approach this
(tell me otherwise) was to log the user in on the server and pass the
iPhone back the 'session ID' in a JSON array.

Then when the iPhone sends me back some info, they send me that same
'session ID' and I match that to the associated user content in order
to get the User details. Does this make sense? Is it the way to go in
order to pass User details back and forth to an iPhone.

If so.

How do I find the User when the iPhone passes me back the 'session
ID'?

Thanks in advance,
Hope all is well your side of town ...


d.

-- 
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: Upload a File using the request.POST data

2010-09-26 Thread Danny Bos
There is no form, it's entirely Javascript.
Spoke to the creator of the script, who has popped up script examples
for PHP and ColdFusion he reckons:

"You basically have to put the whole post contents into a file."

Not altogether helpful, eh?

d


On Sep 27, 1:52 pm, Sam Lai <samuel@gmail.com> wrote:
> Have you got the right attribute in the form?
>
> Fromhttp://docs.djangoproject.com/en/dev/topics/http/file-uploads/
>
> "Note that request.FILES will only contain data if the request method
> was POST and the  that posted the request has the attribute
> enctype="multipart/form-data". Otherwise, request.FILES will be
> empty."
>
> On 27 September 2010 13:21, Danny Bos <da...@stateempire.com> wrote:
>
> > Can it even be done?
> > It seems pretty ordinary but everything I'm trying expects it to be a
> > request.FILE.
>
> > Frustrating stuff.
>
> > d
>
> > On Sep 27, 11:24 am, Danny Bos <da...@stateempire.com> wrote:
> >> Heya,
>
> >> I'm using the 'Valums File Uploader' which passes the file in the
> >> request.POST as you can see below. I'm wondering how to get that data
> >> into an actual file. Any ideas would be great as things like "for
> >> chunk in f.chunks()" only works on request.FILES which in this case is
> >> empty.
>
> >> Thanks,
> >> Hope all is well your side of the planet.
>
> >> Eg DATA:
>
> >> GET:,
> >> POST: >> \ufffd\x03\ufffd\x05\ufffd\ufffd\ufffdC\ufffdC\x1b\ufffd\ufffd\x0f/
> >> \x1eY:\ufffdZ\ufffd \ufffd8': [u''], u'5]]\x1f\u04ff\x7f\ufffd\ufffd
> >> \ufffd\x0f\x054\x15\u0622i\x1c\ufffd(\ufffdG\x01 \ufffd\x03u
> >> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
> >> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
> >> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
> >> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\ufffd\ufffd\ufffd$X]]
> >> \u0775k\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdt\ufffd_2\x13\ufffd\u01cf
> >> \x1fkkk\ufffd\ufffd\ufffdUe\ufffd\ufffd\ufffd\ufffdt2\u04ef\x1f?~|
> >> \ufffd\u0529\ufffd\ufffd$\ufffdx}\ufffd\ufffd*\ufffdNw9': [u''],
> >> u'\uff ... Etc ...
>
> > --
> > 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 
> > athttp://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: Upload a File using the request.POST data

2010-09-26 Thread Danny Bos
Can it even be done?
It seems pretty ordinary but everything I'm trying expects it to be a
request.FILE.

Frustrating stuff.


d

On Sep 27, 11:24 am, Danny Bos <da...@stateempire.com> wrote:
> Heya,
>
> I'm using the 'Valums File Uploader' which passes the file in the
> request.POST as you can see below. I'm wondering how to get that data
> into an actual file. Any ideas would be great as things like "for
> chunk in f.chunks()" only works on request.FILES which in this case is
> empty.
>
> Thanks,
> Hope all is well your side of the planet.
>
> Eg DATA:
>
> GET:,
> POST: \ufffd\x03\ufffd\x05\ufffd\ufffd\ufffdC\ufffdC\x1b\ufffd\ufffd\x0f/
> \x1eY:\ufffdZ\ufffd \ufffd8': [u''], u'5]]\x1f\u04ff\x7f\ufffd\ufffd
> \ufffd\x0f\x054\x15\u0622i\x1c\ufffd(\ufffdG\x01 \ufffd\x03u
> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\ufffd\ufffd\ufffd$X]]
> \u0775k\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdt\ufffd_2\x13\ufffd\u01cf
> \x1fkkk\ufffd\ufffd\ufffdUe\ufffd\ufffd\ufffd\ufffdt2\u04ef\x1f?~|
> \ufffd\u0529\ufffd\ufffd$\ufffdx}\ufffd\ufffd*\ufffdNw9': [u''],
> u'\uff ... Etc ...

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



Upload a File using the request.POST data

2010-09-26 Thread Danny Bos
Heya,

I'm using the 'Valums File Uploader' which passes the file in the
request.POST as you can see below. I'm wondering how to get that data
into an actual file. Any ideas would be great as things like "for
chunk in f.chunks()" only works on request.FILES which in this case is
empty.

Thanks,
Hope all is well your side of the planet.

Eg DATA:

GET:,
POST:http://groups.google.com/group/django-users?hl=en.



Re: Mutli-column composite keys

2010-09-20 Thread Danny Adair
On Mon, Sep 20, 2010 at 08:50, J. P. Smyth
<my.bozo.retarded.work.t...@gmail.com> wrote:
>[...]
> Does anyone have a suggestion how I can achieve this unique primary
> key in Django without resorting to creating another column with the
> company name plus the product id?

Unfortunately
http://code.djangoproject.com/ticket/373#comment:24
is probably as close as you'll get

Cheers,
Danny

-- 
Kind regards,

Danny W. Adair
Director
Unfold Limited
New Zealand

Talk:       +64 - 9 - 9555 101
Fax:        +64 - 9 - 9555 111
Write:      danny.ad...@unfold.co.nz
Browse:     www.unfold.co.nz
Visit/Post: 253 Paihia Road, RD 2, Kawakawa 0282, New Zealand

"We are what we repeatedly do. Excellence, then, is not an act but a habit."

==
Caution
The contents of this email and any attachments contain information
which is CONFIDENTIAL to the recipient. If you are not the intended
recipient, you must not read, use, distribute, copy or retain this
email or its attachments. If you have received this email in error,
please notify us immediately by return email or collect telephone call
and delete this email.  Thank you.  We do not accept any
responsibility for any changes made to this email or any attachment
after transmission from us.
==

-- 
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: www.djangoproject.com

2010-07-14 Thread Danny Adair
Hi,

I had the exact same problem, and I had _not_ installed Weave.
The offending config entry in my case was:
"chrome://global/locale/intl.properties"
and it was at the bottom of the accepted languages list. This is on
Firefox 3.6.6

I can reproduce the problem anytime by visiting about:config and
changing "intl.accept_languages" to
en-nz,en,de,chrome://global/locale/intl.properties

*.djangoproject.com will stop responding, (all?) other websites seem fine.

Cheers,
Danny


On Thu, Jul 15, 2010 at 11:52, Nick Raptis <airsc...@otenet.gr> wrote:
> On 07/14/2010 02:28 PM, Russell Keith-Magee wrote:
>>
>> I'm glad we've worked out that Weave is the culprit, but nobody has
>> answered the question of whether this is an indicator of a problem
>> with Django itself. What is weave passing as a header (and under what
>> conditions) that is causing a problem? Is there a need to improve
>> Django's error handling to protect against this case?
>>
>> Yours,
>> Russ Magee %-)
>>
>>
>
> Hi Russ.
> I hate to admit that I didn't saved that offending value so someone can
> reproduce this.
>
> My reasoning back then for not raising a bug on django was this:
> 1. It was an obvious invalid value. As I said, Weave probably introduced it
> at some point (I guess while still in beta) but other than that, it could
> also be a number of things. Fixing that locale value solves it for good. So
> I rinsed, wiped, forgot.
> 2. I tried to access some other django-powered sites with l10n, and they
> loaded just fine. Only djangoproject.com and djangobook.com had the problem.
> So my guess was that it was caused by something else on that sites' stack
> and not django itself.
> 3. Improving the error-handling of django just didn't cross my mind.
>
> I hope someone else with the same problem here could provide you with the
> offending value.
>
> Nick
>
> --
> 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.
>
>



-- 
Kind regards,

Danny W. Adair
Director
Unfold Limited
New Zealand

Talk:       +64 - 9 - 9555 101
Fax:        +64 - 9 - 9555 111
Write:      danny.ad...@unfold.co.nz
Browse:     www.unfold.co.nz
Visit/Post: 253 Paihia Road, RD 2, Kawakawa 0282, New Zealand

"We are what we repeatedly do. Excellence, therefore, is not an act,
but a habit." - Aristotle

==
Caution
The contents of this email and any attachments contain information
which is CONFIDENTIAL to the recipient. If you are not the intended
recipient, you must not read, use, distribute, copy or retain this
email or its attachments. If you have received this email in error,
please notify us immediately by return email or collect telephone call
and delete this email.  Thank you.  We do not accept any
responsibility for any changes made to this email or any attachment
after transmission from us.
==

-- 
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: Saving File/Image in tmp. I'm in trouble ...

2010-07-13 Thread The Danny Bos

Good point re: if I can upload it to tmp, surely I can delete it. I'll
give that another crack.

Kenneth,
It doesn't delete it from tmp by default in my case, which is why
they're on my back. Turned out there were 40,000 files in there, they
were a bit pissy.

My script that saves it where I define it in "upload_to", upload it to
S3, then delete it from "upload_to" works beautifully. It's just this
damn '/tmp' folder filling up with a copy. Is there anyway to skip
this physical directory and play with each image file in RAM? Or is
that a mad idea?

-- 
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: Saving File/Image in tmp. I'm in trouble ...

2010-07-13 Thread The Danny Bos
Yeh, understood. It's saving a copy of the file to the directory set
by "upload_to", which is where I'm getting the file to push toward S3.
But alongside this it seems to be storing a copy of the file in the
servers '/tmp' directory, this is the step I need to skip or similar.
I'm getting my ass kicked.

-- 
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: Saving File/Image in tmp. I'm in trouble ...

2010-07-13 Thread The Danny Bos
I can't get access to the servers own tmp path, only my own "/home/
72999/data/tmp" which the file isn't saving to.

Madness.

-- 
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: Saving File/Image in tmp. I'm in trouble ...

2010-07-13 Thread The Danny Bos

Forgot to mention, my files are all under 20k.
Very small JPGs.

Cheers,

Danny

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



Saving File/Image in tmp. I'm in trouble ...

2010-07-13 Thread The Danny Bos
Hey there,

Is there any way to skip saving a file to the /tmp directory on a
server?
I got in a lot of trouble from my host when they found 10,000 files
just sitting there from a Django script I'd been running to import
book covers from an API.

So far, the guts of my save code are:

Save the file:
 - item.cover.save("cover name", File(open(the_file_itself)),
save=True)

Within def save() in the model, I send it to S3:
 - temp_file = "This is where the Model saves the file,
upload_to="files/"
 - filedata = open(temp_file, 'rb').read()
 - conn.put(BUCKET_NAME, S3_PATH, s3.S3Object(filedata), {'x-amz-acl':
'public-read', 'Content-Type': 'image/jpeg'})

So, I'm guessing as a default it creates the file under the servers "/
tmp" directory?
This is what I need to change.

I tried:
FILE_UPLOAD_TEMP_DIR = "/a/better/directory/tmp"

But it hasn't changed anything.

Any ideas would be great,
Thanks so much ...

Danny

-- 
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: Localized admin and date field formats

2010-06-25 Thread Danny W. Adair
Hi Alexander,

On Jun 15, 9:54 am, Alexander Jeliuc <jeliucalexa...@gmail.com> wrote:
> Thank You, I found a patch for that. My version is already 1.2.1
> After pathching fields.py and widgets.py it start working fine

It helps others if you mention where they can find such a patch.
I assume it was this:
http://code.djangoproject.com/ticket/13621

Cheers,
Danny


>
> On Tue, Jun 15, 2010 at 12:49 AM, D3f0 <nahuel.defo...@gmail.com> wrote:
> > Hi
> > There's been a slighty change in 1.2, take a look at:
> >http://docs.djangoproject.com/en/dev/ref/settings/#date-input-formats
>
> > Nahuel
>
> > On 13 jun, 09:00, Jeliuc Alexandr <jeliucalexa...@gmail.com> wrote:
> > > Hello.
> > > I'm using django1.2.1 with i18n and l10n enabled...
>
> > > standart django admin date format is mm-dd-
> > > when it changes to Spain it becomes dd/mm/
> > > Not problem it is possible to choice date and save it...
> > > But if I want to edit row it becomes like standart mm-dd-...
> > > No problem... but if I edit row and want to save. I got error - wrong
> > > date format...
>
> > > Question is: How can I change date field format in admin edit form
> > > action? to be like it should be dd/mm/?
> > > Is it bug?
>
> > --
> > 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<django-users%2bunsubscr...@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.



Modify Content-Type to play MP3?

2010-04-17 Thread The Danny Bos
Heya,

I'm trying to modify the content-type of a page to play an MP3.

Basically, instead of pointing directly to an MP3, I'm pointing to a
view in Django to add some stats to the database etc, after all that
baloney is done, I want to go ahead and stream the track.

Is there a way to do this, I figured it would be easy but I've been
stuck on it all day.

Thanks so much,

D

-- 
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: Calling the same views, displaying in different templates

2010-04-13 Thread Danny Adair
On Tue, Apr 13, 2010 at 15:59, rvidal <rvi...@gmail.com> wrote:
>[...]
> I have my urls.py looking something like this:
> urlpatterns = patterns('mysites.shop.views',
>        (r'^$', 'index'),
>        (r'^client/(?P\d+)/$', 'details'),
>        (r'^client/(?P\d+)/receipts/$', 'receipts'),
>        (r'^client/(?P\d+)/contacts/$', 'contacts'),
> )

You could just pass an additional parameter:
===
        (r'^client/(?P\d+)/$', 'myview', {'template_name':
'details'}),
        (r'^client/(?P\d+)/receipts/$', 'myview',
{'template_name': 'receipts'}),
        (r'^client/(?P\d+)/contacts/$', 'myview',
{'template_name': 'contacts'}),
===
def myview(request, client_id, template_name):
===
See
http://docs.djangoproject.com/en/dev/topics/http/urls/#passing-extra-options-to-view-functions

Or let myview figure out the template from the request path.

Cheers,
Danny

-- 
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: GROUP results in views.py

2009-10-30 Thread The Danny Bos

Any ideas anyone?
I'm completely stumped ...




On Oct 30, 12:59 pm, The Danny Bos <danny...@gmail.com> wrote:
> If helpful, here's the table structure.
>
> class ItemOwned(models.Model):
>         user = models.ForeignKey(User)
>         item = models.ForeignKey(Item)
>
> class Item(models.Model):
>         set = models.ForeignKey(Set)
>         number = models.IntegerField()
>
> class Set(models.Model):
>         title = models.CharField(max_length=50, unique=True)
>
> On Oct 30, 11:52 am, The Danny Bos <danny...@gmail.com> wrote:
>
>
>
> > Hey there, I've got the below query, generating the below JSON. But I
> > want to group them by "setId", can I do this in my query or in
> > views.py to create a JSON file like the one at the bottom? Regroup in
> > a template would be great, but doesn't work in views ...
>
> > views.py:
> > items = ItemOwned.objects.filter(user=id)      ### Obviously simple at
> > the moment.
>
> > generates JSON:
> > {"setId": 1, "id": 75},
> > {"setId": 1, "id": 76},
> > {"setId": 1, "id": 77},
> > {"setId": 2, "id": 78},
> > {"setId": 2, "id": 79},
>
> > what I need:
> > {"setId": 1, items: [{ "id": 75},{ "id": 76},{ "id": 77}] },
> > {"setId": 2, items: [{ "id": 78},{ "id": 79}] },
>
> > Know what I mean?
> > Seems like a grouping issue to me.
>
> > I could do a few sub-queries but the results are quite large so it'd
> > be best to do it well.
> > Any code examples would be great as I'm a beginner trying his best ...
>
> > 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-users@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: GROUP results in views.py

2009-10-29 Thread The Danny Bos


If helpful, here's the table structure.

class ItemOwned(models.Model):
user = models.ForeignKey(User)
item = models.ForeignKey(Item)

class Item(models.Model):
set = models.ForeignKey(Set)
number = models.IntegerField()

class Set(models.Model):
title = models.CharField(max_length=50, unique=True)



On Oct 30, 11:52 am, The Danny Bos <danny...@gmail.com> wrote:
> Hey there, I've got the below query, generating the below JSON. But I
> want to group them by "setId", can I do this in my query or in
> views.py to create a JSON file like the one at the bottom? Regroup in
> a template would be great, but doesn't work in views ...
>
> views.py:
> items = ItemOwned.objects.filter(user=id)      ### Obviously simple at
> the moment.
>
> generates JSON:
> {"setId": 1, "id": 75},
> {"setId": 1, "id": 76},
> {"setId": 1, "id": 77},
> {"setId": 2, "id": 78},
> {"setId": 2, "id": 79},
>
> what I need:
> {"setId": 1, items: [{ "id": 75},{ "id": 76},{ "id": 77}] },
> {"setId": 2, items: [{ "id": 78},{ "id": 79}] },
>
> Know what I mean?
> Seems like a grouping issue to me.
>
> I could do a few sub-queries but the results are quite large so it'd
> be best to do it well.
> Any code examples would be great as I'm a beginner trying his best ...
>
> 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-users@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
-~--~~~~--~~--~--~---



GROUP results in views.py

2009-10-29 Thread The Danny Bos

Hey there, I've got the below query, generating the below JSON. But I
want to group them by "setId", can I do this in my query or in
views.py to create a JSON file like the one at the bottom? Regroup in
a template would be great, but doesn't work in views ...

views.py:
items = ItemOwned.objects.filter(user=id)  ### Obviously simple at
the moment.

generates JSON:
{"setId": 1, "id": 75},
{"setId": 1, "id": 76},
{"setId": 1, "id": 77},
{"setId": 2, "id": 78},
{"setId": 2, "id": 79},

what I need:
{"setId": 1, items: [{ "id": 75},{ "id": 76},{ "id": 77}] },
{"setId": 2, items: [{ "id": 78},{ "id": 79}] },

Know what I mean?
Seems like a grouping issue to me.

I could do a few sub-queries but the results are quite large so it'd
be best to do it well.
Any code examples would be great as I'm a beginner trying his best ...

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-users@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
-~--~~~~--~~--~--~---



If search string contains a number ... Do this ...

2009-10-22 Thread The Danny Bos

Hey guys,

In a view, is there a way to check if a search/querystring has a
number in it?

If number in string:
do this
otherwise:
do this instead ...



Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Inner Join perhaps?

2009-10-22 Thread The Danny Bos


Actually, that's no good as it craps out if there's no matching
records in CollectionUser.
Back to the drawing board ... Any better ideas?



d

- - -


On Oct 22, 9:01 pm, The Danny Bos <danny...@gmail.com> wrote:
> Hey there, I want to loop through all items in CollectionItem
> (models.py below), build a list of the items, then get
> CollectionUser.grade if that exists where (user=request.user) and it's
> associated with the item in CollectionItem list.
>
> eg:
>
> "Item 1" - ""
> "Item 2" - "Grade = 89"
> "Item 3" - ""
> "Item 4" - "Grade = 5"
> "Item 5" - "Grade = 34"
> "Item 5" - ""
>
> Here's my models.py
>
> class Collection(models.Model):
>         title = models.CharField(max_length=50, unique=True)
>         description = models.TextField(blank=True)
>
> class CollectionItem(models.Model):
>         collection = models.ForeignKey(Collection)
>         image = models.ImageField(blank=True, upload_to='temp/')
>
> class CollectionUser(models.Model):
>         user = models.ForeignKey(User)
>         collection_item = models.ForeignKey(CollectionItem, blank=True)
>         grade = models.CharField(max_length=10)
>
> Know what I 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-users@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: Inner Join perhaps?

2009-10-22 Thread The Danny Bos


I think I've got it.
Does the below look right and would it run ok with 1000 Items on a
page?

test_sql = ((t, t.collectionuser_set.get(user=request.user)) for t in
CollectionItem.objects.filter(collection=collection))

for item, useritems in test_sql:
print 'Test: %s - %s' % (item.title, useritems.grade)





On Oct 22, 9:01 pm, The Danny Bos <danny...@gmail.com> wrote:
> Hey there, I want to loop through all items in CollectionItem
> (models.py below), build a list of the items, then get
> CollectionUser.grade if that exists where (user=request.user) and it's
> associated with the item in CollectionItem list.
>
> eg:
>
> "Item 1" - ""
> "Item 2" - "Grade = 89"
> "Item 3" - ""
> "Item 4" - "Grade = 5"
> "Item 5" - "Grade = 34"
> "Item 5" - ""
>
> Here's my models.py
>
> class Collection(models.Model):
>         title = models.CharField(max_length=50, unique=True)
>         description = models.TextField(blank=True)
>
> class CollectionItem(models.Model):
>         collection = models.ForeignKey(Collection)
>         image = models.ImageField(blank=True, upload_to='temp/')
>
> class CollectionUser(models.Model):
>         user = models.ForeignKey(User)
>         collection_item = models.ForeignKey(CollectionItem, blank=True)
>         grade = models.CharField(max_length=10)
>
> Know what I 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-users@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
-~--~~~~--~~--~--~---



Inner Join perhaps?

2009-10-22 Thread The Danny Bos

Hey there, I want to loop through all items in CollectionItem
(models.py below), build a list of the items, then get
CollectionUser.grade if that exists where (user=request.user) and it's
associated with the item in CollectionItem list.

eg:

"Item 1" - ""
"Item 2" - "Grade = 89"
"Item 3" - ""
"Item 4" - "Grade = 5"
"Item 5" - "Grade = 34"
"Item 5" - ""

Here's my models.py

class Collection(models.Model):
title = models.CharField(max_length=50, unique=True)
description = models.TextField(blank=True)

class CollectionItem(models.Model):
collection = models.ForeignKey(Collection)
image = models.ImageField(blank=True, upload_to='temp/')

class CollectionUser(models.Model):
user = models.ForeignKey(User)
collection_item = models.ForeignKey(CollectionItem, blank=True)
grade = models.CharField(max_length=10)


Know what I 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-users@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: DateField (Year and Month) only

2009-10-19 Thread The Danny Bos


APologies for my naivety, how would I do that.
Any examples you can point me toward?

Thanks for the fast reply,


d



On Oct 20, 10:38 am, Joshua Russo <josh.r.ru...@gmail.com> wrote:
> On Mon, Oct 19, 2009 at 10:28 PM, The Danny Bos <danny...@gmail.com> wrote:
>
>
>
> > Hiya,
>
> > In the Django Admin for the DateField I only want to display the Year
> > and Month as select lists. I'll default the day to the 1st every time.
> > Is this possible?
>
> > I want to keep the dates very simple, as I'll be adding many items
> > from 1900 to now. So using the current DateField calendar in Django
> > Admin would be an absolute nightmare.
>
> > Any ideas?
>
> Your best bet is to extend the date form field and input widget.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send 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: DateField (Year and Month) only

2009-10-19 Thread The Danny Bos

Hiya,

In the Django Admin for the DateField I only want to display the Year
and Month as select lists. I'll default the day to the 1st every time.
Is this possible?

I want to keep the dates very simple, as I'll be adding many items
from 1900 to now. So using the current DateField calendar in Django
Admin would be an absolute nightmare.

Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Data Looping with a Join? Perhaps ...

2009-10-19 Thread The Danny Bos


Will this display all CollectionTypes even if there is no record for a
user in CollectionUserPile?
As I'd want to set a default item if there isn't, but still loop
through all Types.


d



On Oct 20, 1:35 am, Javier Guerra <jav...@guerrag.com> wrote:
> On Mon, Oct 19, 2009 at 6:53 AM, The Danny Bos <danny...@gmail.com> wrote:
>
>
>
>
>
>
>
> > K, I've got one for ya.
>
> > I've created a new table to handle Users latest "owned" item, how
> > would I get this joined data up in my views.py where I'm currently
> > just looping through CollectionTypes. Tables and current Query is
> > below:
>
> > models.py
> > class CollectionType(models.Model):
> >        title = models.CharField(max_length=50, unique=True) eg: "Pokemon
> > Cards"
> >        slug = models.SlugField(max_length=50, unique=True) eg: "pokemon
> > cards"
>
> > class CollectionUserPile(models.Model):
> >        user = models.ForeignKey(User) eg: "Danny"
> >        collection_item = models.ForeignKey(CollectionItem) eg: "Pokemon Card
> > No.12"
> >        collection_type = models.ForeignKey(CollectionType) eg: "Pokemon
> > Cards"
>
> > views.py
> > types = CollectionType.objects.all().order_by('title')
>
> > So I want to loop through all the CollectionTypes, then in that loop I
> > want to display the collection_item data.
>
> try something like this:
>
> in the view:
>
> mypiles = request.user.collectionuserpile_set.order_by(collection_type)
>
> in the template:
>
> {% for pile in mypiles %}
>   {% ifchanged %} {{pile.type}} {% endifchanged %}
>   {{pile.item}}
> {% endfor %}
>
> --
> 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-users@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
-~--~~~~--~~--~--~---



Data Looping with a Join? Perhaps ...

2009-10-19 Thread The Danny Bos

K, I've got one for ya.

I've created a new table to handle Users latest "owned" item, how
would I get this joined data up in my views.py where I'm currently
just looping through CollectionTypes. Tables and current Query is
below:

models.py
class CollectionType(models.Model):
title = models.CharField(max_length=50, unique=True) eg: "Pokemon
Cards"
slug = models.SlugField(max_length=50, unique=True) eg: "pokemon
cards"

class CollectionUserPile(models.Model):
user = models.ForeignKey(User) eg: "Danny"
collection_item = models.ForeignKey(CollectionItem) eg: "Pokemon Card
No.12"
collection_type = models.ForeignKey(CollectionType) eg: "Pokemon
Cards"

views.py
types = CollectionType.objects.all().order_by('title')


So I want to loop through all the CollectionTypes, then in that loop I
want to display the collection_item data.
Seems easy, but I can't wrap my head around looping through one table
while getting one field where the User = Request.User and
collection_type = CollectionType.

Know what I 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-users@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: Paging, 0-50, 51-100, 101-132

2009-10-11 Thread The Danny Bos


I kind of worked out a way, it seems highly flimsy but it's working.

paging = str(paging)
paging = paging.split("-")
page_from = paging[0]
page_to = paging[1]

items = CollectionItem.objects.filter(collection=collection)
items_paged = CollectionItem.objects.filter
(collection=collection).order_by('number')[page_from:page_to]

paging_links = []
counter = 0
counter_end = 50
selected = False

while counter < len(items):
if counter_end > items.count():
counter_end = items.count()

print counter
print page_from

if int(counter) == int(page_from):
selected = True
else:
selected = False

paging_links.append({'start': counter, 'end': counter_end,
'selected': selected})
counter += 50
counter_end += counter_end



On Oct 11, 8:18 pm, Sam Lai <samuel@gmail.com> wrote:
> 2009/10/11 The Danny Bos <danny...@gmail.com>:
>
>
>
> > I had a read of that, is good but seems overly basic for what I'm
> > trying to achieve.
>
> > Basically a list of links like so on the Template:
>
> > Link: Cards 0-50
> > Link: Cards 51-100
> > Link: Cards 101-132
>
> > Know what I mean?
> > My biggest question being, how can I create that above list with the
> > data I have, basically the record count "132".
>
> Looking through that linked doc, I'd say you can use the
> page.start_index() and page.end_index() properties to give you that
> result for each page.
>
> I haven't used this before, and right now I can't really work out how
> to loop through all the pages to print that information out in the
> templates, but I'd say I'm just missing something obvious.
>
> 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-users@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: Paging, 0-50, 51-100, 101-132

2009-10-11 Thread The Danny Bos


I had a read of that, is good but seems overly basic for what I'm
trying to achieve.

Basically a list of links like so on the Template:

Link: Cards 0-50
Link: Cards 51-100
Link: Cards 101-132

Know what I mean?
My biggest question being, how can I create that above list with the
data I have, basically the record count "132".



d



On Oct 11, 7:41 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Oct 11, 9:22 am, The Danny Bos <danny...@gmail.com> wrote:
>
>
>
>
>
> > Heya, thanks for all the help of late, I'm about four late nights from
> > finishing my first big app I'm guessing.
>
> > Anyway,
> > I'm working on paging in my app and am completely stuck (again),
> > here's what I'm trying for:
> >          eg:http://www.domainname.com/card/pokemon/0-50/
>
> > Which would obviously display a list of 'Pokemon' cards from numbers 0
> > to 50.
>
> > To get those numbers from the URL, I'm doing:
> >         paging = str(paging)
> >         paging = paging.split("-")
> >         page_from = paging[0]
> >         page_to = paging[1]
> >         items = Cards.objects.all()[page_from:page_to]
>
> > Seems to work but may need some error checking, yeh?
>
> > Where I'm really stuck is listing out the pages in the template like
> > so:
> >          0-50, 51-100, 101-132.
>
> > I guess I need to get the Count of the records first, in this case
> > "132". Then how would I loop through and create those links
> > automatically. As each Card set may be different obviously, some may
> > have "43" records, some "682" records etc ... But I still want to page
> > through by "50" each time using the URL.
>
> > Any help would be great, I'm really stumped on this one.
> > Hope that's enough info to get some help.
>
> > d
>
> There is a whole section of the documentation devoted to 
> pagination:http://docs.djangoproject.com/en/dev/topics/pagination/
> including some useful built-in functionality.
> --
> 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-users@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
-~--~~~~--~~--~--~---



Paging, 0-50, 51-100, 101-132

2009-10-11 Thread The Danny Bos

Heya, thanks for all the help of late, I'm about four late nights from
finishing my first big app I'm guessing.

Anyway,
I'm working on paging in my app and am completely stuck (again),
here's what I'm trying for:
 eg: http://www.domainname.com/card/pokemon/0-50/

Which would obviously display a list of 'Pokemon' cards from numbers 0
to 50.

To get those numbers from the URL, I'm doing:
paging = str(paging)
paging = paging.split("-")
page_from = paging[0]
page_to = paging[1]
items = Cards.objects.all()[page_from:page_to]

Seems to work but may need some error checking, yeh?

Where I'm really stuck is listing out the pages in the template like
so:
 0-50, 51-100, 101-132.

I guess I need to get the Count of the records first, in this case
"132". Then how would I loop through and create those links
automatically. As each Card set may be different obviously, some may
have "43" records, some "682" records etc ... But I still want to page
through by "50" each time using the URL.

Any help would be great, I'm really stumped on this one.
Hope that's enough info to get some help.


d

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Show first available Image in a loop

2009-10-10 Thread The Danny Bos


Good point.
Here's the models I'm talking about as they're slightly different than
your aforementioned solution.

class Collection(models.Model):
title = models.CharField(max_length=50, unique=True, help_text="eg:
Pokemon, Kiss, Baseball ...")
slug = models.SlugField(max_length=50, unique=True)
date_added = models.DateField(auto_now=True)

class CollectionItem(models.Model):
collection = models.ForeignKey(Collection)
number = models.IntegerField(help_text="Last Added")
image = models.ImageField(blank=True, upload_to='temp/')
date_added = models.DateField(auto_now=True)


So 'Collection' would be the 'trading card' set, and 'CollectionItem'
would be the individual trading card, eg: Pokemon Card #24. We may
only have images available for a few 'Pokemon' cards, eg: #3, 4, 8, 9.
So getting a default image that way?

See what I mean?


d


On Oct 10, 12:35 pm, Tim Chase  wrote:
> > I'm looping through an array of 'trading card' titles. For instance:
>
> >  - Pokemon
> >  - Kiss
> >  - Baseball
>
> > Instead of showing just the title of the 'trading card', I'd like to
> > display an image of each instead.
> > But not all images are available for every card in a title, for
> > instance 'Pokemon' may only have cards/images for #4, 5, 8, 9 etc.
>
> > How can I get a list of all the titles of 'trading cards' with one
> > image alongside of the first image it finds available.
>
> You don't include code that shows how your view is handing off
> the image-list, but you can define a method on your card to
> return a sample image:
>
>    class Card(Model):
>      # ... stuff ...
>      title = CharField(...)
>      def thumbnail(self):
>        try:
>          return self.image_set[0]
>        except IndexError:
>          return default_image
>    class Image(Model):
>      card = ForeignKey(Card)
>      image = ImageField(...)
>      # ...
>
> which you can then use in your view
>
>    {% for card in cards %}
>      
>       {{ card.title }}
>       
>      
>    {% endfor %}
>
> If you have large quantities of cards, you may want to use
> .select_related() so that the image_set comes back pre-populated.
>   Otherwise, you'll net a lot of extra DB hits you may not want.
>
> -tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Show first available Image in a loop

2009-10-09 Thread The Danny Bos


I had a feeling this was a pain in the ass.
I might try and work out another way around it, maybe a default image
for each 'trading card' set?


d



On Oct 9, 9:54 pm, The Danny Bos <danny...@gmail.com> wrote:
> Hey there,
>
> I'm looping through an array of 'trading card' titles. For instance:
>
>  - Pokemon
>  - Kiss
>  - Baseball
>
> Instead of showing just the title of the 'trading card', I'd like to
> display an image of each instead.
> But not all images are available for every card in a title, for
> instance 'Pokemon' may only have cards/images for #4, 5, 8, 9 etc.
>
> How can I get a list of all the titles of 'trading cards' with one
> image alongside of the first image it finds available.
>
> Know what I mean?
> Thanks so much for your time and energy ...
>
> Danny
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Show first available Image in a loop

2009-10-09 Thread The Danny Bos

Hey there,

I'm looping through an array of 'trading card' titles. For instance:

 - Pokemon
 - Kiss
 - Baseball

Instead of showing just the title of the 'trading card', I'd like to
display an image of each instead.
But not all images are available for every card in a title, for
instance 'Pokemon' may only have cards/images for #4, 5, 8, 9 etc.

How can I get a list of all the titles of 'trading cards' with one
image alongside of the first image it finds available.

Know what I mean?
Thanks so much for your time and energy ...

Danny
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Scaling Thumbnails instead of Cropping or Squashing.

2009-08-24 Thread The Danny Bos


Thanks again Mike, this solved everything.

d



On Aug 24, 1:02 pm, Mike Ramirez <gufym...@gmail.com> wrote:
> On Sunday 23 August 2009 06:48:33 pm The Danny Bos wrote:
>
>
>
>
>
> > Hey, so I've got this code to quickly create thumbnail files, below.
> > When I give it a value, it squishes the image to those dimensions, I'm
> > hoping to keep the correct proportions of a book instead of cropping
> > to a square or squashing.
>
> > Mainly as books can be portrait, landscape or square. So keep the
> > correct proportions, and make the tallest edge '120px'.
>
> > Know what I mean??
>
> > def gen_thumb(source, dest, size=120):
> >    image = Image.open(source)
> >    w,h = image.size
>
> >    tn = image.resize((size,size), Image.ANTIALIAS)
> >    tn.save(dest)
> >    return dest
>
> Try using image.thumbnail()  I've found this does keep the dimensions in
> proportion, regardless of the size passed to it.[1]
>
> Mike
> [1]http://www.pythonware.com/library/pil/handbook/image.htm
>
> --
> You are magnetic in your bearing.
>
>  signature.asc
> < 1KViewDownload
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Scaling Thumbnails instead of Cropping or Squashing.

2009-08-23 Thread The Danny Bos

Hey, so I've got this code to quickly create thumbnail files, below.
When I give it a value, it squishes the image to those dimensions, I'm
hoping to keep the correct proportions of a book instead of cropping
to a square or squashing.

Mainly as books can be portrait, landscape or square. So keep the
correct proportions, and make the tallest edge '120px'.

Know what I mean??


def gen_thumb(source, dest, size=120):
image = Image.open(source)
w,h = image.size

tn = image.resize((size,size), Image.ANTIALIAS)
tn.save(dest)
return dest
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Renaming an image to the SLUG after upload

2009-08-23 Thread The Danny Bos


Much nicer.
Thanks so much Mike ...


d


On Aug 24, 12:17 pm, Mike Ramirez <gufym...@gmail.com> wrote:
> On Sunday 23 August 2009 05:36:13 pm The Danny Bos wrote:
>
>
>
>
>
> > Hey there, I've got the below code.
> > Can someone help me fill in the gaps to rename the image to the
> > 'SLUG'?
>
> > In the end I'm hoping for images like so:
>
> >  ...com/books/book-title.jpg
> >  ...com/books/thumbs/book-title.jpg
>
> > Here's my save() definition from models.py:
>
> > def save(self):
> >    super(Book, self).save()
>
> >    image_path = '%s%s' % (settings.MEDIA_ROOT, str(self.cover))
> >    path, filename = os.path.split(image_path)
>
> >    thumb_name = '%s/thumbs/%s' % (path, filename)
>
> >    gen_thumb(image_path, thumb_name, size=160)
> >    self.thumb = '%s' % filename
>
> >    super(Book, self).save()
>
> Try this:
>
> def gen_thumb(image, size=160):
>     save_path = os.path.join(settings.MEDIA_ROOT, image)  
>     # gen thumb code here
>     image.save(save_path)
>     return
>
> def save(self):
>    thumb_path = os.path.join('books', 'thumbs', 'tn_%s' %(str(self.cover)))
>    gen_thumb(thumb_path):
>    self.thumb = thumb_path
>    super(Book, self).save()
>
> First off, you should use os.path.join() when creating a file path; this will
> allow your code to be os independant as os.path.join() will set the right
> path seperators for the os. (Just a nit picky thing for os independance).
>
> You should set the ImageField to a path relative to your settings.MEDIA_ROOT
> setting, the ImageField will automatically join[1] these together for use
> with thumb.path and you'll be able to use thumb.url for you img html tags
> (i.e.  width="book.thumb.width" height="book.thumb.height" /> ) since the url is
> actually the path relative to the MEDIA_ROOT/MEDIA_URL.
>
> You can alter the gen_thumb to return the relative path and use it in the
> upload_to= option of the ImageField and save yourself the headache, but the
> gen_thumb should follow the instructions in handling uploaded files[2].
>
> Mike
>
> [1]http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield
> [2]http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#handli...
> --
> The trouble is, there is an endless supply of White Men, but there has
> always been a limited number of Human Beings.
>                 -- Little Big Man
>
>  signature.asc
> < 1KViewDownload
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Renaming an image to the SLUG after upload

2009-08-23 Thread The Danny Bos


Worked this one out.
For anyone interested ...

def save(self):
super(Book, self).save()

file_ext = os.path.splitext(str(self.cover.name))[1]
new_filename = '%s%s' % (self.slug, file_ext)
new_filepath = os.path.join(settings.MEDIA_ROOT, new_filename)
old_filepath = os.path.join(settings.MEDIA_ROOT, self.cover.name)
shutil.move(old_filepath, new_filepath)
self.cover.name = os.path.join('p/', new_filename)

super(Book, self).save()




On Aug 24, 10:36 am, The Danny Bos <danny...@gmail.com> wrote:
> Hey there, I've got the below code.
> Can someone help me fill in the gaps to rename the image to the
> 'SLUG'?
>
> In the end I'm hoping for images like so:
>
>  ...com/books/book-title.jpg
>  ...com/books/thumbs/book-title.jpg
>
> Here's my save() definition from models.py:
>
> def save(self):
>         super(Book, self).save()
>
>         image_path = '%s%s' % (settings.MEDIA_ROOT, str(self.cover))
>         path, filename = os.path.split(image_path)
>
>         thumb_name = '%s/thumbs/%s' % (path, filename)
>
>         gen_thumb(image_path, thumb_name, size=160)
>         self.thumb = '%s' % filename
>
>         super(Book, self).save()
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Renaming an image to the SLUG after upload

2009-08-23 Thread The Danny Bos

Hey there, I've got the below code.
Can someone help me fill in the gaps to rename the image to the
'SLUG'?

In the end I'm hoping for images like so:

 ...com/books/book-title.jpg
 ...com/books/thumbs/book-title.jpg

Here's my save() definition from models.py:

def save(self):
super(Book, self).save()

image_path = '%s%s' % (settings.MEDIA_ROOT, str(self.cover))
path, filename = os.path.split(image_path)

thumb_name = '%s/thumbs/%s' % (path, filename)

gen_thumb(image_path, thumb_name, size=160)
self.thumb = '%s' % filename

super(Book, self).save()


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Caught an exception while rendering: Error binding parameter 0 - probably unsupported type.

2009-07-27 Thread The Danny Bos


How did you solve it?
I'm having the same issue.

d



On Jul 27, 12:09 pm, nixon66  wrote:
> problem solved. Type
>
> On Jul 26, 10:05 pm, nixon66  wrote:
>
>
>
> > ran into this error. Anyone familiar with it.
>
> > TemplateSyntaxError at /lobby/lobbytype/public-relations/
>
> > Caught an exception while rendering: Error binding parameter 0 -
> > probably unsupported type.
>
> > Original Traceback (most recent call last):
> >   File "C:\Python25\lib\site-packages\django\template\debug.py", line
> > 71, in render_node
> >     result = node.render(context)
> >   File "C:\Python25\lib\site-packages\django\template\defaulttags.py",
> > line 244, in render
> >     if (value and not ifnot) or (ifnot and not value):
> >   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
> > 191, in __nonzero__
> >     iter(self).next()
> >   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
> > 185, in _result_iter
> >     self._fill_cache()
> >   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
> > 618, in _fill_cache
> >     self._result_cache.append(self._iter.next())
> >   File "C:\Python25\lib\site-packages\django\db\models\query.py", line
> > 275, in iterator
> >     for row in self.query.results_iter():
> >   File "C:\Python25\lib\site-packages\django\db\models\sql\query.py",
> > line 206, in results_iter
> >     for rows in self.execute_sql(MULTI):
> >   File "C:\Python25\lib\site-packages\django\db\models\sql\query.py",
> > line 1734, in execute_sql
> >     cursor.execute(sql, params)
> >   File "C:\Python25\lib\site-packages\django\db\backends\util.py",
> > line 19, in execute
> >     return self.cursor.execute(sql, params)
> >   File "C:\Python25\lib\site-packages\django\db\backends
> > \sqlite3\base.py", line 168, in execute
> >     return Database.Cursor.execute(self, query, params)
> > InterfaceError: Error binding parameter 0 - probably unsupported type.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Cross Table Query. List Books based on Author.

2009-07-27 Thread The Danny Bos


Good point, here are the models for all three tables.
I would have thought the above would work too, but it errors:
Error: Caught an exception while rendering: Error binding parameter 0
- probably unsupported type.

Here's my Table definitions.

#models.py

class Book(models.Model):
title = models.CharField(max_length=120)
slug = models.SlugField(max_length=50)

authors = models.ManyToManyField(People, related_name='authors',
blank=True)
illustrators = models.ManyToManyField(People,
related_name='illustrators', blank=True)

class People(models.Model):
name = models.CharField(max_length=50)
slug = models.SlugField(max_length=50)
is_author = models.BooleanField()
is_illustrator = models.BooleanField()

class Article(models.Model):
title = models.CharField(max_length=120)
slug = models.SlugField(max_length=50)

people = models.ManyToManyField(People, blank=True)



Does that all make sense, or have I got my tables set out quite badly?
Thanks gang, again I'm still wrapping my head around this ...

d



On Jul 28, 1:59 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Jul 27, 4:13 pm, The Danny Bos <danny...@gmail.com> wrote:
>
>
>
>
>
> > Heya,
>
> > I'm currently displaying an 'Article' on a page, using the below. My
> > tables are Article, People, Book. I'm in the 'Article' table, trying
> > to get a list of 'Books' based on the person "selected" in Articles,
> > that person needs to be the Author of the 'Books'. Dig?
>
> > # views.py
> > def article_detail(request, slug):
> >         article = Article.objects.get(slug=slug)
> >         books = Book.objects.filter()
>
> >         return render_to_response('articles/detail.html', {'article':
> > article, 'books': books}, context_instance=RequestContext(request))
>
> > All I'm missing is the "Filter", any idea how to make that look up
> > between Articles.People to Books.Author?
>
> > Thanks,
>
> > d
>
> You haven't given enough information - you haven't stated the
> relationships between the tables, and in particular how People is
> related to Articles.
>
> But assuming that Article and Book both have a ForeignKey to People,
> indicating the author, then it's quite simple:
>
>     books = Book.objects.filter(author=article.author)
>
> Is that what you want?
> --
> 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-users@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
-~--~~~~--~~--~--~---



Cross Table Query. List Books based on Author.

2009-07-27 Thread The Danny Bos

Heya,

I'm currently displaying an 'Article' on a page, using the below. My
tables are Article, People, Book. I'm in the 'Article' table, trying
to get a list of 'Books' based on the person "selected" in Articles,
that person needs to be the Author of the 'Books'. Dig?

# views.py
def article_detail(request, slug):
article = Article.objects.get(slug=slug)
books = Book.objects.filter()

return render_to_response('articles/detail.html', {'article':
article, 'books': books}, context_instance=RequestContext(request))

All I'm missing is the "Filter", any idea how to make that look up
between Articles.People to Books.Author?

Thanks,

d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Get Top 10 Books by Rating and User

2009-07-20 Thread The Danny Bos


Andrew,
I got lazy and installed 1.1, worked out I was able to quite easily.
Your code worked perfectly.

One more twist, is it possible to also match it against a Tag in a
Books tags?
For instance, 'Book Name' has the tags "Vampire, Blood, Beachball".
I want to display the Top 10 Vampire books.

Know what I mean?


d



On Jul 21, 12:44 am, Andrew Fong <fongand...@gmail.com> wrote:
> Unfortunately, it looks the aggregation / sum stuff is in the SVN
> version only for now.
>
> I'm not aware of any other way to do this with the Django 1.0 ORM
> though. As a fallback, you could rely on raw SQL I 
> suppose.http://docs.djangoproject.com/en/1.0/topics/db/sql/
>
> Sorry I couldn't be more helpful here.
>
> -- Andrew
>
> On Jul 20, 10:30 am, The Danny Bos <danny...@gmail.com> wrote:
>
>
>
> > I'm not able to use anything over Django 1.0.2.
> > Does SUM work for this version, I'm getting the error:
>
> > Could not import #.views. Error was: cannot import name Sum
>
> > Is there another way around this?
> > Thanks for your time and energy guys,
>
> > d
>
> > On Jul 21, 12:22 am, Andrew Fong <fongand...@gmail.com> wrote:
>
> > > The relevant documentation btw:
>
> > >http://docs.djangoproject.com/en/dev/topics/db/aggregation/http://doc..
>
> > > On Jul 20, 10:18 am, Andrew Fong <fongand...@gmail.com> wrote:
>
> > > > Assuming your models are like this:
>
> > > > class Book(models.Model):
> > > >     name = models.CharField(max_length=128)
>
> > > > class User(models.Model):
> > > >     is_staff = models.BooleanField(default=False)
>
> > > > class Rating(models.Model):
> > > >     user = models.ForeignKey(User)
> > > >     score = models.IntegerField(default=3)
> > > >     book = models.ForeignKey(Book)
>
> > > > Try this:
>
> > > > from django.db.models import Sum
> > > > Book.objects.filter(rating__user__is_staff=True).annotate(score=Sum
> > > > ('rating__score')).order_by('-score')[0:10]
>
> > > > -- Andrew
>
> > > > On Jul 20, 9:22 am, The Danny Bos <danny...@gmail.com> wrote:
>
> > > > > Hey there,
>
> > > > > I'm looking at getting a Top 10 of all Books on a site, but only where
> > > > > rated by users of a certain Group.
> > > > > Here's what I've got so far:
>
> > > > >         book = Book.objects.all()
>
> > > > > Somewhat impressive, hey?
>
> > > > >  - So, my tables/models are Book, Rating, User.
> > > > >  - I save all ratings in Rating like so "rating | user | book"
> > > > >  - I'd just like the Top 10 as rated by users in the group "Staff".
>
> > > > > Hope that helps,
> > > > > I'm really stuck on how to get this moving.
>
> > > > > d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Get Top 10 Books by Rating and User

2009-07-20 Thread The Danny Bos


That's fine Andrew.
I appreciate it ...


d



On Jul 21, 12:44 am, Andrew Fong <fongand...@gmail.com> wrote:
> Unfortunately, it looks the aggregation / sum stuff is in the SVN
> version only for now.
>
> I'm not aware of any other way to do this with the Django 1.0 ORM
> though. As a fallback, you could rely on raw SQL I 
> suppose.http://docs.djangoproject.com/en/1.0/topics/db/sql/
>
> Sorry I couldn't be more helpful here.
>
> -- Andrew
>
> On Jul 20, 10:30 am, The Danny Bos <danny...@gmail.com> wrote:
>
>
>
> > I'm not able to use anything over Django 1.0.2.
> > Does SUM work for this version, I'm getting the error:
>
> > Could not import #.views. Error was: cannot import name Sum
>
> > Is there another way around this?
> > Thanks for your time and energy guys,
>
> > d
>
> > On Jul 21, 12:22 am, Andrew Fong <fongand...@gmail.com> wrote:
>
> > > The relevant documentation btw:
>
> > >http://docs.djangoproject.com/en/dev/topics/db/aggregation/http://doc..
>
> > > On Jul 20, 10:18 am, Andrew Fong <fongand...@gmail.com> wrote:
>
> > > > Assuming your models are like this:
>
> > > > class Book(models.Model):
> > > >     name = models.CharField(max_length=128)
>
> > > > class User(models.Model):
> > > >     is_staff = models.BooleanField(default=False)
>
> > > > class Rating(models.Model):
> > > >     user = models.ForeignKey(User)
> > > >     score = models.IntegerField(default=3)
> > > >     book = models.ForeignKey(Book)
>
> > > > Try this:
>
> > > > from django.db.models import Sum
> > > > Book.objects.filter(rating__user__is_staff=True).annotate(score=Sum
> > > > ('rating__score')).order_by('-score')[0:10]
>
> > > > -- Andrew
>
> > > > On Jul 20, 9:22 am, The Danny Bos <danny...@gmail.com> wrote:
>
> > > > > Hey there,
>
> > > > > I'm looking at getting a Top 10 of all Books on a site, but only where
> > > > > rated by users of a certain Group.
> > > > > Here's what I've got so far:
>
> > > > >         book = Book.objects.all()
>
> > > > > Somewhat impressive, hey?
>
> > > > >  - So, my tables/models are Book, Rating, User.
> > > > >  - I save all ratings in Rating like so "rating | user | book"
> > > > >  - I'd just like the Top 10 as rated by users in the group "Staff".
>
> > > > > Hope that helps,
> > > > > I'm really stuck on how to get this moving.
>
> > > > > d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Get Top 10 Books by Rating and User

2009-07-20 Thread The Danny Bos


I'm not able to use anything over Django 1.0.2.
Does SUM work for this version, I'm getting the error:

Could not import #.views. Error was: cannot import name Sum

Is there another way around this?
Thanks for your time and energy guys,


d


On Jul 21, 12:22 am, Andrew Fong <fongand...@gmail.com> wrote:
> The relevant documentation btw:
>
> http://docs.djangoproject.com/en/dev/topics/db/aggregation/http://docs.djangoproject.com/en/dev/topics/db/queries/#lookups-that-...
>
> On Jul 20, 10:18 am, Andrew Fong <fongand...@gmail.com> wrote:
>
>
>
> > Assuming your models are like this:
>
> > class Book(models.Model):
> >     name = models.CharField(max_length=128)
>
> > class User(models.Model):
> >     is_staff = models.BooleanField(default=False)
>
> > class Rating(models.Model):
> >     user = models.ForeignKey(User)
> >     score = models.IntegerField(default=3)
> >     book = models.ForeignKey(Book)
>
> > Try this:
>
> > from django.db.models import Sum
> > Book.objects.filter(rating__user__is_staff=True).annotate(score=Sum
> > ('rating__score')).order_by('-score')[0:10]
>
> > -- Andrew
>
> > On Jul 20, 9:22 am, The Danny Bos <danny...@gmail.com> wrote:
>
> > > Hey there,
>
> > > I'm looking at getting a Top 10 of all Books on a site, but only where
> > > rated by users of a certain Group.
> > > Here's what I've got so far:
>
> > >         book = Book.objects.all()
>
> > > Somewhat impressive, hey?
>
> > >  - So, my tables/models are Book, Rating, User.
> > >  - I save all ratings in Rating like so "rating | user | book"
> > >  - I'd just like the Top 10 as rated by users in the group "Staff".
>
> > > Hope that helps,
> > > I'm really stuck on how to get this moving.
>
> > > d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Get Top 10 Books by Rating and User

2009-07-20 Thread The Danny Bos

Hey there,

I'm looking at getting a Top 10 of all Books on a site, but only where
rated by users of a certain Group.
Here's what I've got so far:

book = Book.objects.all()

Somewhat impressive, hey?

 - So, my tables/models are Book, Rating, User.
 - I save all ratings in Rating like so "rating | user | book"
 - I'd just like the Top 10 as rated by users in the group "Staff".

Hope that helps,
I'm really stuck on how to get this moving.


d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Get Top 10 Books by Rating and User

2009-07-20 Thread The Danny Bos

Hey there,

I'm looking at getting a Top 10 of all Books on a site, but only where
rated by users of a certain Group.
Here's what I've got so far:

book = Book.objects.all()

Somewhat impressive, hey?

 - So, my tables/models are Book, Rating, User.
 - I save all ratings in Rating like so "rating | user | book"
 - I'd just like the Top 10 as rated by users in the group "Staff".

Hope that helps,
I'm really stuck on how to get this moving.


d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Checking a User in another Table ...

2009-07-19 Thread The Danny Bos

Hey there, this should be easy, but my code just won't play along.

I've let a logged in user Rate a music record. I'm saving it like so
'rating | user | record'. (Rating model)
What I need to do is only display the Rating form if the logged in
user hasn't rated the record yet, know what I mean.

What code would I need to check that?
I'm still new, albeit I feel I've read every book on the subject
twice.


d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using AVG

2009-07-17 Thread The Danny Bos

Heya,

If I wanted to get the Average of all ratings (in a Rating table) for
a single record.
Would I use something like this:

ratings_avg = Rating.objects.aggregate(Avg('rating'))

And where does this live? In models.py or views.py and how is it
called.
I've been reading a lot about it, but some things seem implied which
I'm having trouble wrapping my head around.

Thanks,

d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Saving Data To Your DB. Simple?

2009-07-16 Thread The Danny Bos

So, I'm guessing this is impossible.
Any ideas would be great ...


d



On Jul 16, 11:52 am, The Danny Bos <danny...@gmail.com> wrote:
> Hopefully my last question on this,
> How do I get back to the page with the form, perhaps with a "Thank
> You" message, without having the POST still available if you hit
> refresh.
> I figured I'd use 'reverse' but not quite sure why it isn't
> working ...
>
> Here's where I am now:
>
> #views.py
> def record_detail(request, slug):
>         record = Record.objects.get(slug=slug)
>         if request.method == 'POST':
>                 form = RatingForm(request.POST)
>                 if form.is_valid():
>                         record_rating = Rating()
>                         record_rating.item_id = record.id
>                         record_rating.writer_id = request.user.id
>                         record_rating.rating = form.cleaned_data['rating']
>                         record_rating.save()
>
>                         return render_to_response(reverse('record_detail', 
> args=[slug]))
>         else:
>                 form = RatingForm()
>         return render_to_response('records/detail.html', {'record_detail':
> record, 'form': form}, context_instance=RequestContext(request))
>
> I get the below error.
>
> NoReverseMatch at /records/temp-record-name/
> Reverse for 'record_detail' with arguments '(u'temp-record-name',)'
> and keyword arguments '{}' not found.
>
> And even if it does get passed back to the original page, how would I
> have a "Thank You" message?
>
> Thanks again,
>
> d
>
> On Jul 16, 10:49 am, Russell Keith-Magee <freakboy3...@gmail.com>
> wrote:
>
>
>
> > On Thu, Jul 16, 2009 at 8:36 AM, The Danny Bos<danny...@gmail.com> wrote:
>
> > > Any ideas on this one guys?
>
> > > I gave up on it last night.
> > > I feel way off ...
>
> > Ok - some back tracking.
>
> > Your first approach (no forms) should have worked. The reason you
> > didn't get any errors is that your code is explicitly ignoring _all
> > errors_. You are catching all exceptions, passing, and moving on. That
> > means that if an error - ANY minor error - is thrown in your 'form
> > processing' code, then it will be silently ignored.
>
> > Step 1 - Make it be not silent. Instead of using:
>
> > except:
> >     pass
>
> > try using
>
> > except Exception, e:
> >     print 'ERROR!!', e
>
> > And see what it says. You will probably find that it's something
> > really simple, like a typo in a variable name somewhere. Fix those
> > issues, and you should find things start to work- the general approach
> > you describe should be fine.
>
> > Your second attempt, using forms, can be made to work in a number of ways.
>
> > 1) Save the values back from the form.
>
> > record_rating.rating = form.cleaned_data['rating']
> > record_rating.record_id = form.cleaned_data['record']
> > record_rating.writer_id = form.cleaned_data['writer']
>
> > I would also note that your form probably won't have values for record
> > and writer - because they are hidden inputs and you're not providing
> > initial values. Look into the `initial` argument to fields, or to the
> > form as a whole.
>
> > 2) Don't put the values on the form in the first place. After all -
> > they're hidden inputs.
>
> > class RatingForm(forms.Form):
> >        rating = forms.ChoiceField(choices=RATING_CHOICES)
> > ...
> > record_rating.rating = form.cleaned_data['rating']
> > record_rating.record = Record.objects.get()
> > record_rating.writer = Writer.objects.get()
>
> > 3) Look at using a ModelForm. This will handle the saving of the
> > entire Rating object; however, given that you seem to want to use
> > hidden inputs, you will need to jump through some extra hoops to
> > override the default widgets. Overriding widgets is covered in the
> > docs.
>
> > Yours,
> > Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Saving Data To Your DB. Simple?

2009-07-15 Thread The Danny Bos


Hopefully my last question on this,
How do I get back to the page with the form, perhaps with a "Thank
You" message, without having the POST still available if you hit
refresh.
I figured I'd use 'reverse' but not quite sure why it isn't
working ...

Here's where I am now:

#views.py
def record_detail(request, slug):
record = Record.objects.get(slug=slug)
if request.method == 'POST':
form = RatingForm(request.POST)
if form.is_valid():
record_rating = Rating()
record_rating.item_id = record.id
record_rating.writer_id = request.user.id
record_rating.rating = form.cleaned_data['rating']
record_rating.save()

return render_to_response(reverse('record_detail', 
args=[slug]))
else:
form = RatingForm()
return render_to_response('records/detail.html', {'record_detail':
record, 'form': form}, context_instance=RequestContext(request))

I get the below error.

NoReverseMatch at /records/temp-record-name/
Reverse for 'record_detail' with arguments '(u'temp-record-name',)'
and keyword arguments '{}' not found.


And even if it does get passed back to the original page, how would I
have a "Thank You" message?

Thanks again,


d



On Jul 16, 10:49 am, Russell Keith-Magee <freakboy3...@gmail.com>
wrote:
> On Thu, Jul 16, 2009 at 8:36 AM, The Danny Bos<danny...@gmail.com> wrote:
>
> > Any ideas on this one guys?
>
> > I gave up on it last night.
> > I feel way off ...
>
> Ok - some back tracking.
>
> Your first approach (no forms) should have worked. The reason you
> didn't get any errors is that your code is explicitly ignoring _all
> errors_. You are catching all exceptions, passing, and moving on. That
> means that if an error - ANY minor error - is thrown in your 'form
> processing' code, then it will be silently ignored.
>
> Step 1 - Make it be not silent. Instead of using:
>
> except:
>     pass
>
> try using
>
> except Exception, e:
>     print 'ERROR!!', e
>
> And see what it says. You will probably find that it's something
> really simple, like a typo in a variable name somewhere. Fix those
> issues, and you should find things start to work- the general approach
> you describe should be fine.
>
> Your second attempt, using forms, can be made to work in a number of ways.
>
> 1) Save the values back from the form.
>
> record_rating.rating = form.cleaned_data['rating']
> record_rating.record_id = form.cleaned_data['record']
> record_rating.writer_id = form.cleaned_data['writer']
>
> I would also note that your form probably won't have values for record
> and writer - because they are hidden inputs and you're not providing
> initial values. Look into the `initial` argument to fields, or to the
> form as a whole.
>
> 2) Don't put the values on the form in the first place. After all -
> they're hidden inputs.
>
> class RatingForm(forms.Form):
>        rating = forms.ChoiceField(choices=RATING_CHOICES)
> ...
> record_rating.rating = form.cleaned_data['rating']
> record_rating.record = Record.objects.get()
> record_rating.writer = Writer.objects.get()
>
> 3) Look at using a ModelForm. This will handle the saving of the
> entire Rating object; however, given that you seem to want to use
> hidden inputs, you will need to jump through some extra hoops to
> override the default widgets. Overriding widgets is covered in the
> docs.
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Saving Data To Your DB. Simple?

2009-07-15 Thread The Danny Bos


Russ, this makes a lot of sense, thanks so much.
I'll give it a go now ...


d



On Jul 16, 10:49 am, Russell Keith-Magee <freakboy3...@gmail.com>
wrote:
> On Thu, Jul 16, 2009 at 8:36 AM, The Danny Bos<danny...@gmail.com> wrote:
>
> > Any ideas on this one guys?
>
> > I gave up on it last night.
> > I feel way off ...
>
> Ok - some back tracking.
>
> Your first approach (no forms) should have worked. The reason you
> didn't get any errors is that your code is explicitly ignoring _all
> errors_. You are catching all exceptions, passing, and moving on. That
> means that if an error - ANY minor error - is thrown in your 'form
> processing' code, then it will be silently ignored.
>
> Step 1 - Make it be not silent. Instead of using:
>
> except:
>     pass
>
> try using
>
> except Exception, e:
>     print 'ERROR!!', e
>
> And see what it says. You will probably find that it's something
> really simple, like a typo in a variable name somewhere. Fix those
> issues, and you should find things start to work- the general approach
> you describe should be fine.
>
> Your second attempt, using forms, can be made to work in a number of ways.
>
> 1) Save the values back from the form.
>
> record_rating.rating = form.cleaned_data['rating']
> record_rating.record_id = form.cleaned_data['record']
> record_rating.writer_id = form.cleaned_data['writer']
>
> I would also note that your form probably won't have values for record
> and writer - because they are hidden inputs and you're not providing
> initial values. Look into the `initial` argument to fields, or to the
> form as a whole.
>
> 2) Don't put the values on the form in the first place. After all -
> they're hidden inputs.
>
> class RatingForm(forms.Form):
>        rating = forms.ChoiceField(choices=RATING_CHOICES)
> ...
> record_rating.rating = form.cleaned_data['rating']
> record_rating.record = Record.objects.get()
> record_rating.writer = Writer.objects.get()
>
> 3) Look at using a ModelForm. This will handle the saving of the
> entire Rating object; however, given that you seem to want to use
> hidden inputs, you will need to jump through some extra hoops to
> override the default widgets. Overriding widgets is covered in the
> docs.
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Saving Data To Your DB. Simple?

2009-07-15 Thread The Danny Bos

Any ideas on this one guys?

I gave up on it last night.
I feel way off ...


d



On Jul 15, 11:33 pm, The Danny Bos <danny...@gmail.com> wrote:
> Agreed, I should get used to using Forms.
> So I gave it a go, the new problem I have is out of my three fields,
> two need to be hidden and have values automatically assigned from the
> page they're on. This is freaking me out.
>
> Now I have:
>
> # forms.py
> class RatingForm(forms.Form):
>         record = forms.CharField(widget=forms.HiddenInput)
>         critic = forms.CharField(widget=forms.HiddenInput)
>         rating = forms.ChoiceField(choices=RATING_CHOICES)
>
> #views.py
> def record_detail(request):
>         if request.method == 'POST':
>                 form = RatingForm(request.POST)
>                 if form.is_valid():
>                         record_rating = Rating()
>
>                         record_rating.rating = form.cleaned_data['rating']
>                         record_rating.record = 
>                         record_rating.writer = 
>                         record_rating.save()
>
>                         return HttpResponseRedirect('/')
>         else:
>                 ...
>
> How do I get the User.ID (as you'll need to be logged in), into that
> hidden field or the DB. And also the Record.ID from the page I was
> just on.
>
> Know what I mean. Am I way off?
> I'm new to this, so any detailed help is very welcome.
>
> Thanks again,
>
> d
>
> On Jul 15, 2:37 am, Lakshman Prasad <scorpion...@gmail.com> wrote:
>
>
>
> > > It runs OK (no errors) but doesn't save a single thing
>
> >      It has to run without errors because you have enclosed the whole thing
> > in try.
>
> >      You have to coerce the record_id and user_id into int before assigning
> > to the model fields, for it to save.
>
> > On Tue, Jul 14, 2009 at 9:45 PM, The Danny Bos <danny...@gmail.com> wrote:
>
> > > Heya, am trying to simply save 3 values to a database, without using
> > > Forms.
>
> > > In the Template:
>
> > > 
> > >        
> > >        
> > >        Rate This: {% for n in numbers %} > > value="{{ n }}">{{ n }}{% endfor %}
> > >        
> > > 
>
> > > In the View:
>
> > > from mysite.rating.models import Rating
> > > def critics_rating(request):
> > >        try:
> > >                record_id = request.POST['record_id']
> > >                user_id = request.POST['user_id']
> > >                rating_val = request.POST['rating']
>
> > >                rating = Rating()
> > >                rating.rating = rating_val
> > >                rating.item = record_id
> > >                rating.writer = user_id
> > >                rating.save()
>
> > >                return HttpResponseRedirect('/')
> > >        except:
> > >                pass
> > >        obj = Record.objects.get(id=record)
> > >        return render_to_response('record/detail.html', {'object_detail':
> > > obj}, context_instance=RequestContext(request))
>
> > > It runs OK (no errors) but doesn't save a single thing, also it goes
> > > back to the 'detail.html' page fine, but when you hit reload, it sends
> > > the data again. Again, not saving.
>
> > > Any ideas what's wrong with this?
> > > I've done a lot of searching but all people seem to use the Forms
> > > widget, I was thinking as this is only three fields I'd skip that.
> > > Silly?
>
> > --
> > Regards,
> > Lakshman
> > becomingguru.com
> > lakshmanprasad.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Saving Data To Your DB. Simple?

2009-07-15 Thread The Danny Bos

Agreed, I should get used to using Forms.
So I gave it a go, the new problem I have is out of my three fields,
two need to be hidden and have values automatically assigned from the
page they're on. This is freaking me out.

Now I have:

# forms.py
class RatingForm(forms.Form):
record = forms.CharField(widget=forms.HiddenInput)
critic = forms.CharField(widget=forms.HiddenInput)
rating = forms.ChoiceField(choices=RATING_CHOICES)

#views.py
def record_detail(request):
if request.method == 'POST':
form = RatingForm(request.POST)
if form.is_valid():
record_rating = Rating()

record_rating.rating = form.cleaned_data['rating']
record_rating.record = 
record_rating.writer = 
record_rating.save()

return HttpResponseRedirect('/')
else:
...


How do I get the User.ID (as you'll need to be logged in), into that
hidden field or the DB. And also the Record.ID from the page I was
just on.

Know what I mean. Am I way off?
I'm new to this, so any detailed help is very welcome.

Thanks again,


d



On Jul 15, 2:37 am, Lakshman Prasad <scorpion...@gmail.com> wrote:
> > It runs OK (no errors) but doesn't save a single thing
>
>      It has to run without errors because you have enclosed the whole thing
> in try.
>
>      You have to coerce the record_id and user_id into int before assigning
> to the model fields, for it to save.
>
> On Tue, Jul 14, 2009 at 9:45 PM, The Danny Bos <danny...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Heya, am trying to simply save 3 values to a database, without using
> > Forms.
>
> > In the Template:
>
> > 
> >        
> >        
> >        Rate This: {% for n in numbers %} > value="{{ n }}">{{ n }}{% endfor %}
> >        
> > 
>
> > In the View:
>
> > from mysite.rating.models import Rating
> > def critics_rating(request):
> >        try:
> >                record_id = request.POST['record_id']
> >                user_id = request.POST['user_id']
> >                rating_val = request.POST['rating']
>
> >                rating = Rating()
> >                rating.rating = rating_val
> >                rating.item = record_id
> >                rating.writer = user_id
> >                rating.save()
>
> >                return HttpResponseRedirect('/')
> >        except:
> >                pass
> >        obj = Record.objects.get(id=record)
> >        return render_to_response('record/detail.html', {'object_detail':
> > obj}, context_instance=RequestContext(request))
>
> > It runs OK (no errors) but doesn't save a single thing, also it goes
> > back to the 'detail.html' page fine, but when you hit reload, it sends
> > the data again. Again, not saving.
>
> > Any ideas what's wrong with this?
> > I've done a lot of searching but all people seem to use the Forms
> > widget, I was thinking as this is only three fields I'd skip that.
> > Silly?
>
> --
> Regards,
> Lakshman
> becomingguru.com
> lakshmanprasad.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Saving Data To Your DB. Simple?

2009-07-14 Thread The Danny Bos

Heya, am trying to simply save 3 values to a database, without using
Forms.

In the Template:




Rate This: {% for n in numbers %}{{ n }}{% endfor %}



In the View:

from mysite.rating.models import Rating
def critics_rating(request):
try:
record_id = request.POST['record_id']
user_id = request.POST['user_id']
rating_val = request.POST['rating']

rating = Rating()
rating.rating = rating_val
rating.item = record_id
rating.writer = user_id
rating.save()

return HttpResponseRedirect('/')
except:
pass
obj = Record.objects.get(id=record)
return render_to_response('record/detail.html', {'object_detail':
obj}, context_instance=RequestContext(request))

It runs OK (no errors) but doesn't save a single thing, also it goes
back to the 'detail.html' page fine, but when you hit reload, it sends
the data again. Again, not saving.

Any ideas what's wrong with this?
I've done a lot of searching but all people seem to use the Forms
widget, I was thinking as this is only three fields I'd skip that.
Silly?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Count from 1 to 50

2009-07-14 Thread The Danny Bos


Great idea.
Don't know why I didn't think of that ...

Thanks man,

d



On Jul 15, 12:48 am, Shawn Milochik <shawn.m...@gmail.com> wrote:
> On Jul 14, 2009, at 10:27 AM, The Danny Bos wrote:
>
>
>
> > Is there a way to create a simple list using Django to go from 1 to
> > 50.
> > Eg:
>
> > 1, 2, 3, 4, 5 ... 49, 50
>
> > I figured it'd be easy, but I can't get it.
> > I tried ...
>
> >    {% for i = 1 in 10 %}
> >      {{ i }},
> >    {% endfor %}
>
> > No go.
>
> There may be a better way, but why not just pass a range in the context?
>
> context = {'numbers': range(1,51)}
>
> Then you can do:
>
> {% for num in numbers %}
> ...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Count from 1 to 50

2009-07-14 Thread The Danny Bos

Is there a way to create a simple list using Django to go from 1 to
50.
Eg:

1, 2, 3, 4, 5 ... 49, 50

I figured it'd be easy, but I can't get it.
I tried ...

{% for i = 1 in 10 %}
  {{ i }},
{% endfor %}

No go.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Database Model Layout Advice

2009-07-14 Thread The Danny Bos


So the Author and Illustrator tables would stay as is.
How would the Interview table talk to both of those tables at once, to
allow me to assign an interview to who I'm interviewing. Whether it's
an Illustrator, Author or even down the track a Publisher.

Like so?

class Interview(models.Model):
body = models.TextField()
publication_date = models.DateField(auto_now=True)

interview_subject = ...

class Meta:
ordering = ['publication_date']




On Jul 14, 11:19 pm, Shawn Milochik  wrote:
> I think you'd just have the interview table without any foreign keys,  
> then add a ManyToMany to each of your Author and Illustrator models.
>
> You would still, of course, be able to start with your interview table  
> and get the authors or illustrators, if necessary in your app. It  
> might be handy to set the related_name property of this field for easy  
> reference from your Interview model.
>
> 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-users@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
-~--~~~~--~~--~--~---



Database Model Layout Advice

2009-07-14 Thread The Danny Bos

Hey there, this may not be appropriate, but I'm building in Django so
here goes ...

I'm creating an Interviews app/table in my Django 'Books' (test)
project. Just wrapping my head around it before I start on my music
based website ... Anyway,

For my 'Interview' table, how would I assign an interview to an
'Author' or an 'Illustrator', as they both have separate tables
themselves. Know what I mean? Seems crazy to choose either the Author
from the list OR the Illustrator, how would I assign an Interview to
either?

Here's the layout for 'Interview':

class Interview(models.Model):
body = models.TextField()
publication_date = models.DateField(auto_now=True)

author = models.ForeignKey('books.Author')
illustrator = models.ForeignKey('books.Illustrator')

class Meta:
ordering = ['publication_date']


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Display Data From Multiple Tables

2009-07-02 Thread The Danny Bos

Daniel,

{% for author in review.item.author_set.all %}
Is what I've been using.

TINo, no errors at all, it just doesn't display.
Agreed it is a ManyToMany type. Am thinking perhaps a ForeignKey type
may work just fine. Any reason you guys can think of that an Author
field should be a ManyToMany?


d


- - -

On Jul 3, 12:13 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Jul 2, 2:55 pm, The Danny Bos <danny...@gmail.com> wrote:
>
>
>
>
>
> > K, I think I have it.
>
> > Just having trouble getting the Author loop from within my Review
> > set.
> > Here's what I have below, I figured this was pretty close but I'm
> > wrong aren't I?
>
> >         {% for review in reviews_full %}
> >                 {{ review.item.title }}
> >                 {{ review.item.publisher.name }}
>
> >                 {% for author in review.item.author_set.all %}
> >                         {{ author.name }},
> >                 {% endfor %}
>
> >                 {{ review.pream }}
> >         {% endfor %}
>
> > Any ideas would be great.
> > Hope the above makes some sense ...
>
> > d
>
> Should be:
> {% for author in review.item.author_set.all %}
> because the link from book to authors is a manytomany relationship,
> not a backwards foreign key (which is when you use *_set).
> --
> 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-users@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: Display Data From Multiple Tables

2009-07-02 Thread The Danny Bos


DR.
Bingo!!

Thanks man,
And thanks for the tip on "_set" being for ForeignKeys.

d



On Jul 3, 12:23 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Jul 2, 3:20 pm, The Danny Bos <danny...@gmail.com> wrote:> Daniel,
>
> > {% for author in review.item.author_set.all %}
> > Is what I've been using.
>
> Aargh, copy and paste fail. Should have been
> {% for author in review.item.authors.all %}
> --
> 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-users@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: Display Data From Multiple Tables

2009-07-02 Thread The Danny Bos

K, I think I have it.

Just having trouble getting the Author loop from within my Review
set.
Here's what I have below, I figured this was pretty close but I'm
wrong aren't I?

{% for review in reviews_full %}
{{ review.item.title }}
{{ review.item.publisher.name }}

{% for author in review.item.author_set.all %}
{{ author.name }},
{% endfor %}

{{ review.pream }}
{% endfor %}

Any ideas would be great.
Hope the above makes some sense ...

d



On Jul 2, 10:22 pm, Alex Robbins <alexander.j.robb...@gmail.com>
wrote:
> You should take a look at select_related[1]. It will take the lot of
> queries TiNo was talking about and flatten it down to one big one.
>
> [1]http://docs.djangoproject.com/en/dev/ref/models/querysets/#id4
>
> Hope that helps,
> Alex
>
> On Jul 1, 1:34 pm, TiNo <tin...@gmail.com> wrote:
>
>
>
> > On Wed, Jul 1, 2009 at 16:59, The Danny Bos <danny...@gmail.com> wrote:
>
> > > Hi there,
>
> > > Seems easy, but I'm having an ass of a time. I think once I wrap my
> > > head around how to do this, I'll be rolling through Django like it's
> > > building sprites on a Commodore 64.
>
> > > So, I have four tables. Book, Publisher, Author and Review. A classic
> > > scenario.
> > > I want to display a loop on the home page showing all Reviews, display
> > > the Book.Title, Publisher.Name and Author.Name(s) among other things.
> > > One thing to note is, Publisher, Author, Book live in the 'books' APP
> > > and Review lives in the 'reviews' APP.
>
> > > Am keen to hear how to create a view and a template to display all of
> > > this linked data in one set.
>
> > A simple way would be to use:
>
> > #views.py:
> > reviews = Review.objects.all()
>
> > #template:
>
> > {% for r in reviews %}
> >     {{ r.item.title }}, {{ r.item.publisher.name }}
> >     {% for author in r.item.authors %}
> >         {{ author.name }}
> >     {% endfor %}
> > {% endfor %}
>
> > but that would create a lot of queries (1 for all Reviews + 3 per Review).
>
> > I don't know if it is possible, but maybe you could annotate [1] your
> > reviews with the associated values through the F() object [2] ? Just a wild
> > guess...
>
> > [1]http://docs.djangoproject.com/en/dev/ref/models/querysets/#annotate-a...
> > [2]http://docs.djangoproject.com/en/dev/topics/db/queries/#filters-can-r...
>
> > > Here are the models for each:
>
> > > class Publisher(models.Model):
> > >        name = models.CharField(max_length=120)
>
> > > class Author(models.Model):
> > >        name = models.CharField(max_length=120)
>
> > > class Book(models.Model):
> > >        title = models.CharField(max_length=120)
> > >        publication_date = models.DateField(blank=True, null=True)
> > >        authors = models.ManyToManyField(Author)
> > >        publisher = models.ForeignKey(Publisher)
>
> > > class Review(models.Model):
> > >        pream = models.TextField(blank=True)
> > >        body = models.TextField()
> > >        item = models.ForeignKey('books.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-users@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
-~--~~~~--~~--~--~---



Display Data From Multiple Tables

2009-07-01 Thread The Danny Bos

Hi there,

Seems easy, but I'm having an ass of a time. I think once I wrap my
head around how to do this, I'll be rolling through Django like it's
building sprites on a Commodore 64.

So, I have four tables. Book, Publisher, Author and Review. A classic
scenario.
I want to display a loop on the home page showing all Reviews, display
the Book.Title, Publisher.Name and Author.Name(s) among other things.
One thing to note is, Publisher, Author, Book live in the 'books' APP
and Review lives in the 'reviews' APP.

Am keen to hear how to create a view and a template to display all of
this linked data in one set.
Here are the models for each:

class Publisher(models.Model):
name = models.CharField(max_length=120)

class Author(models.Model):
name = models.CharField(max_length=120)

class Book(models.Model):
title = models.CharField(max_length=120)
publication_date = models.DateField(blank=True, null=True)
authors = models.ManyToManyField(Author)
publisher = models.ForeignKey(Publisher)

class Review(models.Model):
pream = models.TextField(blank=True)
body = models.TextField()
item = models.ForeignKey('books.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-users@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 unicode model pickle problem

2009-06-29 Thread Danny Davidson

I wouldn't consider myself an expert with Unicdoe, but I do know that
pickle and cPickle use ASCII for serialization.  If you have utf-8
characters stored as attributes in the object you're pickling, that
could cause the codec error.

On Jun 22, 10:15 pm, Rodrigo Cea  wrote:
> I am having trouble pickling, and then saving to the DB, django models
> with Unicode text in them. The site is for Spanish speakers, so we
> need our ñs, és and ös.
>
> I implemented an unlimited undo feature for a Django site, using this
> PickleField snippet:
>
> http://www.djangosnippets.org/snippets/513/.
>
> I created a model that holds each object's state at a certain
> datetime, like so:
>
> from fields import PickledObjectField
>
> class UndoRecord(models.Model):
>     user = models.ForeignKey(User)
>     pickle = PickledObjectField()
>     date = models.DateTimeField(auto_now_add=True)
>
> and then in my views, whenever a user changes something, I save an
> UndoRecord like so:
>
> undo = UndoRecord(user=request.user, pickle=obj)
> undo.save()
>
> This works fine, except when the object that I am saving has non-ASCII
> characters in it, which case I get a lovely:
>
> DjangoUnicodeDecodeError: 'utf8' codec can't decode bytes in position
> 372-373: invalid data. You passed in "crbml_core.models\nMusico\np1\n
> (tRp2\n(dp3\nS'foto'\np4\nccopy_reg\n_reconstructor\np5\n
> (cdjango.db.models.fields.files\nImageFieldFile\np6\nc__builtin__
> \nobject\np7\nNtRp8\n
> (dp9\nS'_committed'\np10\nI01\nsS'_file'\np11\nNsS'name'\np12\nVuploads/
> musicos/235470296_54ae5af3e9_o.jpg
> \np13\nsS'closed'\np14\nI00\nsbsS'user_id'\np15\nNsS'visible'\np16\nI1\nsS' 
> influencias'\np17\nVFaith
> No More\np18\nsS'nombre'\np19\nV\xd1\xed\xfa\xf6\np20\nsS'id'\np21\nL2L
> \nsb." ()
>
> I have been trying to fix this using the approach show 
> here:http://www.mail-archive.com/django-users@googlegroups.com/msg67883.html,
> but no such luck.
>
> Unicode errors are my particular achilles' heel, so any help is much
> appreciated.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: link to a local file for download?

2009-04-28 Thread Danny Brown

check your file permissions. Must be readable by www-data

On Tue, Apr 28, 2009 at 1:27 PM, Cai Yizhi  wrote:
> Dear Malcolm,
>
> Thanks for your reply. I put the full path:
>
>
>  href="file:///Users/caiyizhi/Dropbox/Programming/Django/genocad_prolog/prolog_compiler/bin/2009-04-28_12-
> 02-29_results.txt" target="_blank">Test
>
> And I click on the link, nothing comes out. I am wondering how to get this
> done.
>
> Thanks,
> Patrick
>
>
> Yizhi Cai, GBCB Ph.D Student
> Virginia Bioinformatics Institute
> Virginia Tech,Blacksburg, VA 24061
>
>
> On Tue, Apr 28, 2009 at 12:46 PM, Malcolm Tredinnick
>  wrote:
>>
>> On Tue, 2009-04-28 at 12:24 -0400, Cai Yizhi wrote:
>> > Hello,
>> >
>> > I am a new comer to Django. I want to create hyper link pointing to a
>> > local text file (say ~/a.txt). I am wondering how to do this in
>> > Django?
>> >
>> > I have tried:
>> > Download
>> >
>> > But it doesn't work.
>>
>> That's because "~" doesn't mean anything to the filesystem. It's a
>> special character that is interpreted by the shell (well, some shells;
>> not all) to mean the current user's home directory. You'll need to put
>> in the full path to the user's home directory. Look at things like the
>> standard Python module "pwd" if you need assistance doing that.
>>
>> Regards,
>> Malcolm
>>
>>
>>
>>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send 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 say Hello "Somebody" in a Django form. Displaying data context values as non-input.

2009-03-16 Thread Danny Brown

thisusername = str(request.user.username)
data = {'thisusername':username,}
form = form_class(data)

shouldn't this be data={'thisusername':thisusername,} or
{'thisusername': str(request.user.username)}


On Mon, Mar 16, 2009 at 2:14 PM, NoviceSortOf  wrote:
>
> Thanks for your responses, they have helped.
>
> I've read the documentation many times, and only resort to groups
> after re-reading what I can find in the docs, testing various logical
> solutions, digging through groups and finally confering with a 3rd
> party book I've here on Django. If all else fails,
> then I post to groups.
>
> So that is why I'm puzzled when {{ var }} does not present var on my
> form.
>
> As mentioned above in views.py I'm passing data to the form_class in
> this example I'm using str to convert value to string.
>
> in view.py then
> ...
> thisusername = str(request.user.username)
> data = {'thisusername':username,}
> form = form_class(data)
>
> Now it seems form_class() would be adding the data to
> itself with form_class(data) but it isn't.
>
> Instead I have to add the context to the render_to_response
> despite the fact that this data has been added to form
> earlier.
>
> ie.
> return render_to_response(template_name, { 'form': form},
>                              context_instance=context)
>
> will either not display the item, or force it to be viewed
> only as a corresponding writable field as defined in forms.py
> or model.py.
>
> but loading it directly to render_to_response works...
>
> return render_to_response(template_name, { 'form': form,
> 'thisusername':username},
> context_instance=context)
>
> So perhaps a better question would be is
>
> in view.py...
> ---
> thisusername = str(request.user.username)
> data = {'thisusername':username,}
> form = form_class(data)
>
> Why is it form_class(data) does not accept the data
> as declared and enable it to presented it in
> templates in any other form than a writable field
>  --  when render_to_response allows the data to be
>     presented as a string?
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



fieldset in admin, filter model

2009-03-13 Thread Danny Brown

have this
fieldsets=[
(None,{'fields': ['plc_sys']}),
('TS',{'fields': ['context']}),
]

want to filter foreign key context like this
.exclude(pk__in=VoipGateway.objects.values_list('name',flat=True))
Is there a way to add this to the definition

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can't run django on Apache

2009-03-04 Thread Danny Brown

try above but change /mysite to /mysite/ and settings to mysite/settings

On Wed, Mar 4, 2009 at 3:31 PM, Maines, John  wrote:
>
>
> Thanks. That's one of the about 50 variables I have tried with the path 
> settings ... still no luck.
>
> -- John
>
> -Original Message-
> From: django-users@googlegroups.com
> [mailto:django-us...@googlegroups.com]on Behalf Of xankya
> Sent: Wednesday, March 04, 2009 4:28 PM
> To: Django users
> Subject: Re: Can't run django on Apache
>
>
>
> I guess u need to set python path to mysite plus django folders
>
> In httpd.conf:
>
> 
>    SetHandler python-program
>    PythonHandler django.core.handlers.modpython
>    SetEnv DJANGO_SETTINGS_MODULE settings
>    PythonDebug On
>    PythonPath "['path to mysite', 'path to django'] + sys.path"
> 
>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



  1   2   >