Re: django ORM with asyncio

2018-09-25 Thread luke lukes
yet to be > started. > > Andrew > > On Tue, Sep 18, 2018 at 5:55 AM luke lukes > wrote: > >> I'm looking for something that can allow the usage of the Django ORM with >> asyncio (with PostgreSQL). >> >> As of now I found only aiopg <https://

django ORM with asyncio

2018-09-18 Thread luke lukes
I'm looking for something that can allow the usage of the Django ORM with asyncio (with PostgreSQL). As of now I found only aiopg in the *asyncio ecosystem* , which allows to run raw SQL or to use SQLAlchemy only. I then fou

python - handling HTTP requests asynchronously

2016-05-06 Thread luke lukes
Hi everyone, I need to generate a PDF report for each entry of a django queryset. There'll be between between 30k and 40k entries. The PDF is generated through an external API. Since currently is generated on demand, this is handled synchronously via an HTTP request/response. That will be dif

django admin fieldsets - adding fields of related models

2014-07-14 Thread luke lukes
I have a model `*Employee*` with a OneToOne relationship with `*User*`. I'm trying to include in the Employee admin some User fields (`*first_name, last_name, username, email*`), in order to edit those fields directly from the Employee Add/Change form, but I still haven't figured out how to do i

Django ModelForms - testing forms with model that have M2M inline instance using an intermediate model

2013-12-25 Thread luke lukes
I have invoice/estimates django app, I need to write tests for it. Since I'm a beginner with this, testing forms results hard for me. This is the code - for models, form and admin: # MODELS class Invoice(models.Model): subject = models.ForeignKey( Subject, verbose_name=

Django admin - dinamically update through ajax choices of a ChoiceField in a ModelForm

2013-09-21 Thread luke lukes
Hi everyone. I'm stucking with a ModelForm in the admin. I have two ChoicheField which are populated with choices in __init__: self.fields['city'] = forms.ChoiceField( required=False, ) self.fields['city'].choices=get_cities_tuple(region_code=region_code) self.fields['city'].initial = my_ini

Re: CachedStaticFilesStorage with database cache backend - static file not found (404)

2013-06-24 Thread luke lukes
) is missing in an app (django-tinymce), though without storage enabled I don't get any error. - Files are served correctly without hash token. Il giorno sabato 22 giugno 2013 13:47:39 UTC+2, Denis Cornehl ha scritto: > > Hi Luke, > > 2013/6/21 luke lukes >: > > [snip]

CachedStaticFilesStorage with database cache backend - static file not found (404)

2013-06-21 Thread luke lukes
Hi everyone. I've enabled CachedStaticFileStorage . I'm using db as cache backend. I followed all the things said in the django docs, now my settings looks like this: # cache table settings

django admin - changelist view: keep selected items on multiple pages

2013-01-23 Thread luke lukes
a question about admin: in the changelist page, is it possible to keep the selected items of a page while going to another page and returning to it. I mean: 1. I'm on the page 1; 2. I select some

django admin: keeping selected items on different page in changelist view

2013-01-23 Thread luke lukes
Hi everyone. a question about admin: in the changelist page, is it possible to keep the selected items of a page while going to another page and returning to it. I mean: 1. I'm on the page 1; 2. I select some items; 3. then i go to page 2; 4. I select other items; 5. I return

Re: django - adding a counter for every ManyToMany field added

2012-11-13 Thread luke lukes
vembre 2012 23:25:28 UTC+1, Nikolas Stevenson-Molnar ha scritto: > > With an Invoice instance, you can easily get the number of related > Activity objects: > > i = Invoice.objects.get(pk=1) > num_activities = i.activities.all().count() > > _Nik > > On 11/13/2012 12:4

django - adding a counter for every ManyToMany field added

2012-11-13 Thread luke lukes
Hi everyone. hi have these models: #models.py class Subject(models.Model): name = models.CharField("Name",max_length=50, blank=True) ... ... class Activity(models.Model): label = models.CharField("Act. name",max_length=150) price = models.DecimalField("price", max_digits=10, decimal_place

Re: django forms - overriding constructor for changing field type depending by input

2012-05-20 Thread luke lukes
the form.errors print show an empty dict. The form is returned back and instead of renderized ChoiceFields as select, i got these messages printed in html: ...any help? Il giorno domenica 20 maggio 2012 14:21:39 UTC+2, Paul Prior ha scritto: > > I think you need self.fields[field_name] =

Re: django forms - overriding constructor for changing field type depending by input

2012-05-20 Thread luke lukes
Il giorno domenica 20 maggio 2012 13:49:28 UTC+2, luke lukes ha scritto: > > Hi. already tried this way --> fields are instantiated > () but are not > rendered in the template... > > Il giorno domenica 20 maggio 2012 03:25:36 UTC+2, somecallitblues ha > scritto: >&

Re: django forms - overriding constructor for changing field type depending by input

2012-05-20 Thread luke lukes
s. > > Try this http://dpaste.com/hold/750356/ > > Cheers, > > -m > > > > On 20 May 2012 10:06, luke lukes wrote: > >> hi everyone. i need to overrid the constructor of a form: if i have some >> value in input, some fields has to be ChoiceField, otherwise they h

django forms - overriding constructor for changing field type depending by input

2012-05-19 Thread luke lukes
hi everyone. i need to overrid the constructor of a form: if i have some value in input, some fields has to be ChoiceField, otherwise they have to be CharField. here's the code: http://dpaste.com/750343/ but this way doesn't work. even if i declare fields before constructor as CharField and t

Re: deploying django - including third party apps

2012-04-26 Thread luke lukes
enied* any help? Il giorno giovedì 26 aprile 2012 04:32:01 UTC+2, Daniel Sokolowski ha scritto: > > If you have shell access you could do a virtualenv/pip combo install. > > *From:* luke lukes > *Sent:* Wednesday, April 25, 2012 11:14 AM > *To:* django-users@googlegro

deploying django - including third party apps

2012-04-25 Thread luke lukes
hi everyone. i'm developing a simple CRUD django app and my idea is to host it on a free web hosting site that supports django (e.g. alwaysdata.com or heliohost.org). I havent tried locally to deploy it on a web server such as Apache, i've alway used the development server by manage.py runserver

reportlab.platypus - frame and background image made with Canvas

2012-04-19 Thread luke lukes
Hi everyone. i'm using Reportlab to output an invoice on a simple Django app. I've already modified the code many times and here's the result: http://dpaste.com/734262/ . Well, this code doesn't work. the issue seems to be on the section from line to line 105 and line 108, on which i got the follow

reportlab.platypus - rendering template with a right aligned image in the template header as background

2012-04-10 Thread luke lukes
hi everyone. i'm tryng to use Reportlab to output an invoice on a simple Django app. it seems quite difficult to do simple things like this. here's my code: http://dpaste.de/mSXQm/ with this code, my header image is always rendered on page center. i want to insert it on the right (like that: http

Re: Django - Forms Widget TypeChoiceField - how to set id for two radio buttons

2011-12-28 Thread luke lukes
t"}) > > > > > > > > On Tue, Dec 27, 2011 at 3:08 AM, Mengu wrote: > > hi luke, > > > instead of setting auto_id to False, you should give it a string > > parameter. please read more on > > >https://docs.djangoproject.com/en/dev/ref/for

Django - Forms Widget TypeChoiceField - how to set id for two radio buttons

2011-12-26 Thread luke lukes
hi everyone. i'm using a form with a TypeChoiceField, this is the form code: http://pastebin.com/GHttrDyN. now i'm trying to set a custom id for the two radio buttons displayed but i havent found yet the right way. maybe it's possible set it during form instantiation (as i set auto_id=False) in the

Django - ValidationError on saving a model instance containing DateField

2011-11-26 Thread luke lukes
hi everyone. I'm working on this view: http://dpaste.com/661995/ and i have a ValidationError while trying to save the model instance. the error is 'Enter a valid date in -MM-DD format'. the datefield is correctly filled, the type of instance passed to model is unicode. I have to do something l

django model forms validation and error display

2011-11-01 Thread luke lukes
i have this template: http://dpaste.com/645468/ that send data to this view: http://dpaste.com/645469/. the template display a form made by modelforms, with a custom layout. i have to validate the fields value send to view, and then redirect to the same template if the field validation fails. i've

Re: django request.POST data caching

2011-11-01 Thread luke lukes
nt them to see, even if it is just additional form > fields (within the same, or another, view). > > I'm not sure what you're trying to achieve by clicking on the "back" button > -- but if you give some more information on what you're actually trying to > achieve, I&

django request.POST data caching

2011-10-29 Thread luke lukes
hi have a template with a form and many inputs that pass some data trough a POST request to a view, that process them and send the result to another template. in the final template, if i use the browser back button to jump to the first view, i can see again old data. i refresh the page and i insert