Re: Django-cart. How to run method add_to_cart?

2013-10-02 Thread Leonardo Giordani
Hi Ricardo, well this is a question that needs a good explanation. I try to give you some hints about what you need to research about: a. You need to send data to the Django server through a POST view. This is a HTTP "verb", that is one of many different ways the browser has to communicate with y

Re: Best practice for server-generated downloads?

2013-10-02 Thread Russell Keith-Magee
On Wed, Oct 2, 2013 at 2:33 PM, DJ-Tom wrote: > Hi, > > this is quite easy to answer - those reports need to be archived - users > must be able to download them days or weeks later. > > So I will create a record in a database for each report that is created so > users can access it later - maybe

Custom Filter: Filter output based on a Python list

2013-10-02 Thread +Emmanuel
Am working on a Django project that retrieves a student's details from the database, filters them based on the 'period of examination' (this is implemented as a python list in a custom filter) and displays the output. *Here is my custom filter:* @register.filter def periodofexamination(periodof

Re: Best practice for server-generated downloads?

2013-10-02 Thread Jirka Vejrazka
Hi Thomas, I'm doing exactly this - allowing users to download (graphically simple) XLSx files from my web app, it also needs to be available for download weeks later. As Russell pointed out, you don't need to store data on this if you have a way of getting the same set of data later, you can

Re: Custom Filter: Filter output based on a Python list

2013-10-02 Thread Leonardo Giordani
I'd cycle in the template through a list of exam periods, printing a table for each cycle. You have to pass the list of exam periods in the context of your view. Try and let me know. Regards, Leo Leonardo Giordani Author of The Digital Cat My profile on About.me

Re: Best practice for server-generated downloads?

2013-10-02 Thread François Schiettecatte
Hi +1 on this except that I use xlrd and xlwt to read and write Excel files. To generate the excel file I just generate a list of lists (an array effectively) and pass that through a function which walks the list and generates the excel worksheet that I write to a StringIO so it can be returned

Re: Custom Filter: Filter output based on a Python list

2013-10-02 Thread +Emmanuel
That's what I have been trying to do for quite sometime now! I can't seem to get the code right. On Wednesday, October 2, 2013 2:13:25 PM UTC+3, Leo wrote: > > I'd cycle in the template through a list of exam periods, printing a table > for each cycle. > You have to pass the list of exam periods

Re: Custom Filter: Filter output based on a Python list

2013-10-02 Thread Leonardo Giordani
Can you perhaps paste the view you are using to render the template? So I can try and help your with some code Leonardo Giordani Author of The Digital Cat My profile on About.me - My GitHub page- My Cod

model inheritance

2013-10-02 Thread Roberto López López
Hi, I am extending a 3rd party model in my application, using multi-table inheritance. I can create an instance and modify it, but when I try to list the created objects at http://localhost:8000/en/admin/news/news/ , I am getting a nice exception: Traceback: File "/home/roberto/.virt

Re: Custom Filter: Filter output based on a Python list

2013-10-02 Thread +Emmanuel
Here's the view: def results_page(request): queryset = Results.objects.all().filter(reg_number = 'DBA/20020/82/DU') return render_to_response('results.html', locals(), context_instance = RequestContext(request)) Please note that, so far, there's nothing wrong with the view. Using the cus

automated unit test generation

2013-10-02 Thread skunkwerk
Hi, I've been working on an open source project to auto-generate unit tests for web apps based on traces collected from the web server and static code analysis. I've got an alpha version online at www.splintera.com, and the source is at https://github.com/splintera/python-django-client. I'

Re: Custom Filter: Filter output based on a Python list

2013-10-02 Thread Leonardo Giordani
Ok, now I get the point. I STRONGLY suggest to avoid performing big computations while rendering templates, so I think it is better for you to try something like def results_page(request): context = {} context.update(locals()) context['periods'] = {} for period in ['DECEMBER 2011',

Re: model inheritance

2013-10-02 Thread Leonardo Giordani
Are you sure your DB has been synced after putting the ForeignKey(News) in your Department model? Can you post somewhere the following models: News, OldNews, Department? Regards, Leo Leonardo Giordani Author of The Digital Cat My profile on About.me

Re: Two sets of registration with django-registration

2013-10-02 Thread Vibhu Rishi
hi I have updated and using All Auth now. I also liked it that i can do the social logins and the linkedin login seems to be working so far :) Can you point me to documentation on how to ovveride the methods ? I dont know so much about this part of django and am a bit at a loss in my implementati

Re: automated unit test generation

2013-10-02 Thread Derek
Imran Sounds very useful (I am now in that position of having to generate tests for an existing code base). Can this be run as a stand-alone tool? I ask because your website says "we continue to collect data on real-world usage through low overhead sampling on your production servers"; but th

Re: Best practice for server-generated downloads?

2013-10-02 Thread Timothy W. Cook
I tried to return a generated file but it seems that the Admin interface (or middleware?) is capturing my response. I get a brief blank page and then the Admin interface again without eve getting the download prompt. My last attempt looked like this: fname = 'ccd-'+self.ct_id+'.xsd' respo

Re: model inheritance

2013-10-02 Thread Roberto López López
Hi Leonardo, thanks for your answer. Yes, it has been synced. The model itself is a little bit bigger, as you can notice from the code https://dpaste.de/c3Rg I am using as well the News model from https://github.com/wildfish/cmsplugin_news/blob/master/cmsplugin_news/models.py Regards, Roberto

Django 1.4 Form Wizard and browser back button document expired

2013-10-02 Thread Laura Morgan
Hi, Working on a 3 step process, using a SessionWizardView class in Django 1.4 Form wizard. In IE (mostly, although have seen in other browsers), If user hits browser back button instead of the form PREV button, in some cases it gives "Document expired". This probably isn't a wizard thing, bu

Re: model inheritance

2013-10-02 Thread Roberto López López
Is there maybe a way to set the cmsplugin_news.News.Meta.abstract option to True? In order to prevent accessing the parent model to fetch the inherited data. On 10/02/2013 03:45 PM, Leonardo Giordani wrote: > Are you sure your DB has been synced after putting the > ForeignKey(News) in your Depa

Re: how to start learning Django in Windows Platform

2013-10-02 Thread Vernon D. Cole
You can run all of the tutorial stuff in Windows, and it's not a bad idea to learn things one-at-a-time. I would suggest, however, that if you are serious about using django, you need to learn Linux, too. The easiest way to do that would be to download the current Ubuntu desktop version, make

new project: django-mini-lean. no more excuses for not split testing!

2013-10-02 Thread Dan Ancona
Hiya django-users - Long time lurker, and long time user of many open source projects that I've never felt like I contributed enough back to. Finally changing that a bit today with the release of this an open source split testing framework, Django Mini Lean: https://github.com/DanAncona/django

Is there an equivalent to JPA @embedded in django modeling

2013-10-02 Thread Khanh Tran
Lets say both Customer and Business have an Address. In JPA, we can store address attributes(street,city,state,zip) directly inside Customer and Business using @Embedded annotation.Is there an equivalent to @embedded in python without using ForeignKey field. -- You received this message becau

Re: Is there an equivalent to JPA @embedded in django modeling

2013-10-02 Thread Jonathan D. Baker
Could you use an abstract base class to define the address fields and then inherit from that? Sent from my iPhone > On Oct 2, 2013, at 4:55 PM, Khanh Tran wrote: > > Lets say both Customer and Business have an Address. In JPA, we can store > address attributes(street,city,state,zip) directly

Tests not loading initial_data fixtures

2013-10-02 Thread Sam Lai
I'm trying to test a Django management command in app X that parses data files and inserts data into models that are located in apps Y and Z. Apps Y and Z have initial_data.json files in them. On running my test however, it seems that my initial_data fixtures are not being loaded. I could specify

is it possible to make the |safe template filter conditional on content

2013-10-02 Thread Mike Dewhirst
I made a custom template filter (ref_href) which converts numbered references (like [1], [2] etc) into footnote hyperlinks. It works but requires the |safe filter which is dangerous. To be actually safe I want to *only* use the |safe filter when the data contains a numbered reference. Which I