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 dyn

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 Industri

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 dep

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

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,

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 ex

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,

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

Django + PostgreSQL Installation (pipenv install psycopg2)

2019-04-10 Thread Danny Blaker
https://www.google.com/url?sa=t&source=web&rct=j&url=https://stackoverflow.com/questions/11618898/pg-config-executable-not-found&ved=2ahUKEwitxePlncfhAhVDwIsBHeQbBTEQjjgwAHoECAkQAg&usg=AOvVaw1ujp9GSEZRKKrkOSHWdMiD -- You received this message because you are subscribed to the Google Groups "Djan

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@google

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

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 Decem

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, i

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 mo

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://do

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

Re: Installing Django

2017-01-30 Thread Danny Jr Chu
> 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

Re: Installing Django

2017-01-30 Thread Danny Jr Chu
jango. 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 fo

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

Re: Installing Django

2017-01-30 Thread Danny Jr Chu
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

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:\Us

Re: Django authorisation within PostgreSQL

2016-11-23 Thread Danny Remmerswaal
other when I login as an "analyst". If this is not possible within the timeframe I have, I'd have to go with the second option, but it wouldn't be my preferred choice. Hopefully this explains it a bit more! If there's anything else you need to know, please ask. With ki

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')

broken imports in python3.3 + django 1.5

2013-04-26 Thread danny
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. than

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

"Current" timezone in admin

2012-01-12 Thread Danny W. Adair
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

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

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

App namespace/packages?

2011-08-30 Thread Danny W. Adair
k 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 p

trouble serving static content within an included javascript libary

2011-05-26 Thread Danny Shevitz
; 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 -- Y

newbie question regarding passwords and service requests

2011-03-23 Thread Danny Shevitz
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 e

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

Re: Flatten template?

2011-01-11 Thread Danny Adair
nd. 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 wrote: > Hi, > I need to get the te

Flatten template?

2011-01-10 Thread Danny W. Adair
e 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

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 fai

Re: iPhone talking to Django server (matching session)

2010-09-29 Thread Danny Bos
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 wrote: > > > Heya, > > > I've got a Django application talking to an iPhone sending photos and > > User data back

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

Re: Upload a File using the request.POST data

2010-09-26 Thread Danny Bos
multipart/form-data". Otherwise, request.FILES will be > empty." > > On 27 September 2010 13:21, Danny Bos wrote: > > > Can it even be done? > > It seems pretty ordinary but everything I'm trying expects it to be a > > request.FILE. > > > Fru

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 wrote: > Heya, > > I'm using the 'Valums File Uploader' which passes the file in the > request.POST as

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, Hop

Re: Mutli-column composite keys

2010-09-20 Thread Danny Adair
/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 Roa

Re: www.djangoproject.com

2010-07-14 Thread Danny Adair
out: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 wrote: > On 07/14/2010 02:28 PM, Russell Keith-Mage

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 defin

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 ki

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

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, sen

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

2010-07-13 Thread The Danny Bos
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

Re: Localized admin and date field formats

2010-06-25 Thread Danny W. Adair
: http://code.djangoproject.com/ticket/13621 Cheers, Danny > > On Tue, Jun 15, 2010 at 12:49 AM, D3f0 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 &g

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 f

Re: Calling the same views, displaying in different templates

2010-04-13 Thread Danny Adair
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, D

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 wrote: > If helpful, here's the table structure. > > class ItemOwned(models.Model): >         user = models.ForeignKey(User) >         item = models.ForeignKey(Item) > > class It

Re: GROUP results in views.py

2009-10-29 Thread The Danny Bos
title = models.CharField(max_length=50, unique=True) On Oct 30, 11:52 am, The Danny Bos 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

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

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 Grou

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 wrote: > Hey there, I want to loop through all items in CollectionItem > (models.py below),

Re: Inner Join perhaps?

2009-10-22 Thread The Danny Bos
'Test: %s - %s' % (item.title, useritems.grade) On Oct 22, 9:01 pm, The Danny Bos 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.use

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" - "" "It

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 wrote: > On Mon, Oct 19, 2009 at 10:28 PM, The Danny Bos wrote: > > > > > Hiya, > > > In the Django Admin for t

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 Dja

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 wrote: > On Mon, Oct 19, 2009 at 6:53 AM, The Dan

Data Looping with a Join? Perhaps ...

2009-10-19 Thread The Danny Bos
els.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"

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

2009-10-11 Thread The Danny Bos
.append({'start': counter, 'end': counter_end, 'selected': selected}) counter += 50 counter_end += counter_end On Oct 11, 8:18 pm, Sam Lai wrote: > 2009/10/11 The Danny Bos : > > > > > I had a read of that, is good but s

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

2009-10-11 Thread The Danny Bos
have, basically the record count "132". d On Oct 11, 7:41 pm, Daniel Roseman wrote: > On Oct 11, 9:22 am, The Danny Bos wrote: > > > > > > > Heya, thanks for all the help of late, I'm about four late nights from > > finishing my first big app I'

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 dis

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

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 wrote: > Hey there, > > I'm looping through an array of 'trading card' ti

Show first available Image in a loop

2009-10-09 Thread The Danny Bos
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?

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

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

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

Re: Renaming an image to the SLUG after upload

2009-08-23 Thread The Danny Bos
w_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 wrote: > Hey there, I'

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,

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 excep

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

2009-07-27 Thread The Danny Bos
dels.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 wrote: > On Jul

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_deta

Re: Get Top 10 Books by Rating and User

2009-07-20 Thread The Danny Bos
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 wrote: > > > > > I'm not able to use anything over Django 1.

Re: Get Top 10 Books by Rating and User

2009-07-20 Thread The Danny Bos
ck, 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 wrote: > > > > > I'm not able to use anything over

Re: Get Top 10 Books by Rating and User

2009-07-20 Thread The Danny Bos
core = 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

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

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

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.

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

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

Re: Saving Data To Your DB. Simple?

2009-07-15 Thread The Danny Bos
h 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,

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 wrote: > On Thu, Jul 16, 2009 at 8:36 AM, The Danny Bos wrote: > > > Any ideas on this one guys? > > > I gave up on it last night. > > I fee

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

Re: Saving Data To Your DB. Simple?

2009-07-15 Thread The Danny Bos
y. > >      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 wrote: > > > > > > > > > Heya, am trying to simply save 3 values to a database, witho

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:

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

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 re

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):

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 inter

Re: Display Data From Multiple Tables

2009-07-02 Thread The Danny Bos
ManyToMany? d - - - On Jul 3, 12:13 am, Daniel Roseman wrote: > On Jul 2, 2:55 pm, The Danny Bos wrote: > > > > > > > K, I think I have it. > > > Just having trouble getting the Author loop from within my Review > > set. > > Here's what I h

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 wrote: > On Jul 2, 3:20 pm, The Danny Bos wrote:> Daniel, > > > {% for author in review.item.author_set.all %} > > Is what I've been u

Re: Display Data From Multiple Tables

2009-07-02 Thread The Danny Bos
Jul 1, 1:34 pm, TiNo wrote: > > > > > On Wed, Jul 1, 2009 at 16:59, The Danny Bos 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 thr

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 h

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

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_res

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 hav

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

  1   2   >