Re: interaction between two django app

2017-01-25 Thread Daniele Procida
On Tue, Jan 24, 2017, Lorenzo Bernardi  wrote:

>   I don't know what is the best approach for the communication between 
>two django applications.
>
>   We have a website using django and django-cms. We have another 
>application, the "seminar" app for managing some informations like 
>seminars, news,  people profiles They have both their databases and 
>are on different server. Now we would like to take some information from 
>the "seminar" appli and show them on the website. My question is how to 
>retrieve the data from the seminar app. We are developping both 
>applications so we can do whatever we want but for now we would like to 
>keep them separated. To display the information on the website I was 
>thinking of using template tags to gather the information and send them 
>to the page and I see 3 different ways to do access the information.

I think that given what you describe about the way the applications are being 
developed (by different teams, to meet different needs, which may evolve in 
different ways) that you are right to keep them loosely-coupled.

>1) consider the distant database as a simple database and perform 
>queries in SQL.
>
>2) use the models.py file of the seminar app (or use inspectdb) and 
>use database router to gather the information from the distant database 
>mode.

Both these sound like bad ideas, given that you don't have control over the 
other database and application.

>3) make a REST api of the seminar application ( I have no idea how 
>to do that and perhaps it is not the correct approach)

This sounds by far the most sensible way to proceed.

You can't guarantee how the seminar application will contibue to be developed, 
or even if it will stay a Django application, but as long as the developer 
contibnue to provide a API that provides your application with the data it 
needs, you don't even need to care.

Now your only problem is to learn how to make REST APIs! But there is plenty of 
help available for that.

(If the two applications were to be run in the same project, and developed with 
a high degree of co-ordination, then you could consider using django CMS 
plugins to deliver Seminar information into other pages. But from what you 
describe, your best approach is to use them as REST clients for the information 
on the other system.)

Daniele

-- 
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/20170125102724.1383850049%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: Why was Roberto Rosario silently removed from the Django Software Foundation?

2016-11-13 Thread Daniele Procida
On Sun, Nov 13, 2016, Mario R. Osorio  wrote:

>Mr Rosario

We respectfully ask all users of this email list not to engage in discussions 
of this kind about individuals. It's not the place for it.

If anyone feels that they have been wronged or ill-treated by anyone else in or 
representing the Django Software Foundation, or by some part of the Django 
organisation, please contact the Board in confidence. They will receive a 
reply, and their concerns will be taken seriously. 

Thanks.

Daniele, on behalf of the DSF board

-- 
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/20161113230815.146739409%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: friends dont let django suck

2016-08-15 Thread Daniele Procida
On Mon, Aug 15, 2016, Saeon Tao  wrote:

>Arrive at this marvel of a website and input any normal, ordinary SQL query 
>and click >enter
>The SQL query then goes to django head office mainframe, where their very 
>special computer can figure out a deeply complicated "django queryset" to 
>match the SQL,

I have to admit, I never imagined I might read this proposal to make life 
easier...

Daniele

-- 
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/20160815090348.1086777816%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: django 1.9, migrations

2016-07-29 Thread Daniele Procida
On Fri, Jul 29, 2016, Jorge Cadena  wrote:

>I am dev in django at last 4 years, i missed ./manage.py syncdb,

Please change your email subject to something more polite.

You have a good chance to get expert help here from people, including perhaps 
people who helped create the Django migrations system - don't be rude about it.

Daniele

-- 
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/20160729151611.1391620346%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: Beginner question regarding virtualenv

2016-06-23 Thread Daniele Procida
On Thu, Jun 23, 2016, Leo  wrote:

>I have been following the Django tutorial but recently discovered some 
>other Django tutorials which led me to posting this question. I didn't 
>create a Python vitrualenv rather installed everything at the root of the 
>OS. I am unsure if this will cause me problems or if I can proceed with 
>this approach. I do not plan to use the VM for anything else but this 
>specific intranet site.

You'll probably get away with it! But, using virtualenvs really will make your 
life easier and happier as you continue.

Daniele

-- 
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/20160623185024.144689%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: Support Please

2016-04-26 Thread Daniele Procida
On Tue, Apr 26, 2016, Katie Chubb  wrote:

>I need to get in contact with someone who can help me make changes to the 
>client facing home page. I am new to the marketing role at the company and 
>the details have not been passed on. Is there anyone who can help me with 
>this? 

Without knowing details of your system, it's impossible to offer much useful 
advice.

If your site is running Django, you will typically be able to log in to the 
admin at /admin (i.e. append "/admin" to the address of the site in your 
browser).

But, you will need a username and password to proceed any further than that.

If your site runs a well-known Django application, then you may be able to get 
some help about using it. 

However, you need with some urgency to get hold of as much information as 
possible from the previous site manager, and to find out who set up the site in 
the first place.

Daniele

-- 
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/20160426104942.1437945901%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


PGConf US 2016 - free tickets for Django community members

2016-03-19 Thread Daniele Procida
The organisers of PGConf US 2016, the biggest Postgres conference in the world, 
have offered five full conference tickets worth US$439.00 each to the Django 
community.



Daniele

-- 
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/20160316234358.63625479%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


django CMS 3.2 is now available

2015-11-25 Thread Daniele Procida
Hello, we released django CMS 3.2 last night, which we are very excited about.

There are lots of new improvements and functionality, but we think we have a 
Django first: a CMS with (near-complete) touch-screen support, not just for 
published websites, but for all the editing interfaces. 

(It was quite a bit harder than it sounds, let's put it like that.)

There's more at , 
and a live demo at .

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20151125093248.891532270%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


The django CMS Network

2015-04-02 Thread Daniele Procida
Dear django CMS friends,

You might be interested in the django CMS Network.

There's a preview at  but it will be appearing 
on django-cms.org soon too.

It hasn't officially been launched yet, but will be publicly available in the 
next week or so.

If you work with django CMS - backend/frontend developer, agency, or whatever - 
you can get on the Network before the crowds rush in.

It's completely free to sign up, and will help put you - and the whole django 
CMS ecosystem - on the map. It takes a couple of minutes to complete the 
process; instructions at 

Regards,

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150402135133.1533636538%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Message from David about views

2015-03-16 Thread Daniele Procida
Yesterday I accidentally rejected a message from a new user called David about 
views.

Unfortunately Google Groups gives us no logs of any kind, so I have no way of 
correcting the error or contacting David.

So David: if you're reading this, please try sending your message again, and 
sorry for the mistake.

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150316082335.8822958%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


DjangoCon Europe 2015

2015-03-11 Thread Daniele Procida
Dear friends in Django,

There's just one week left to submit a talk for this year's DjangoCon in 
Cardiff.



If you don't think you're the right person to give a talk, please reconsider - 
and don't just take our word for it, read what Erik Romijn has to say on the 
subject: .

We have a speaker mentor programme for those who'd like to make use of it: 
.

Conference tickets are still available but selling fast.

There are DSF funds to help support attendees: 
.

We have a really packed programme of tutorials and workshops and more planned. 
There's a free crèche, good accessibility provision, and more. 

Everything's on the conference website - look there for further information.

Regards,

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150311213436.1521285396%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: Recommendations for hosting service?

2015-01-06 Thread Daniele Procida
On Mon, Jan 5, 2015, Bobby Mozumder  wrote:

>Anyone have recommendations for hosting services that can do Django,
>Node.js, Postgreqsl, python3, as well as PHP/MySQL for legacy stuff? 
>I'm also looking to have IMAP email.  This would be for several domains,
>with maybe 100GB of data.

I recommend Django Europe - . You get shell 
access.I've used them for years. Very reliable, the rates seem reasonable, and 
support is superb. 

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150106115733.526848132%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


DjangoCon Europe 2015 registration is open

2015-01-04 Thread Daniele Procida
Hi everyone.

Registration for tickets and the call for proposals are now open, with a 
special one-month window exclusive to members of under-represented groups.

So, "minority-only registration" (we couldn't think of a better term) is 
available now. Everyone else will have to wait until February, for general 
registration (it won't hurt them; they'll still be able to get the same tickets 
at the same prices).

If any of these apply to you:

* you're not male, western, white, aged between 20 and 40 and able-bodied 
* you've never been to a conference before
* you have family to look after so find it hard to go to conferences

you qualify as 'under-represented'. In which case, please do make use of this 
invitation to get your registration in first.

And if not, if you have any friends or colleagues who are eligible to take 
advantage of this policy, please take the opportunity to tell them about it. 



We've tried to keep prices as affordable as possible:

Early bird  Standard
Individual  £225£275
Student £150£200
Corporate   £300£350

And financial assistance will be available for people on low budgets.

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20150104213917.738764222%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: ANN: Django website redesign launched

2014-12-17 Thread Daniele Procida
On Wed, Dec 17, 2014, Rob  wrote:

>On Tuesday, December 16, 2014 5:58:00 PM UTC-5, Christian Schmitt wrote:
>>
>> Somehow I hate it. The website is the worst website I've seen since a long 
>> time.
>> The contrast is really aweful.
>> The issue Tracker got unusable due to the colors that aren't focused on 
>> readability.
>>
>
>Clearly.  My audit extension flags 47 contrast problems on the home page 
>alone.  The site is not very accessible contrast wise.
>
>Doesn't look like a designer or a graphic guy had his hands on that.
>>
>
>It clearly had a designer,  but they don't grok usability.
>
>I hate to be "that guy" but this is not really an improvement other than it 
>works on mobile now ...

We'd hate you to be "that guy" too. However, so far you are "that guy", since 
merely announcing that you have identified numerous accessibility issues is 
useless. 

The repository is . It's all open. 
If you're able to suggest or make improvements, you know what to do if you want 
to stop being "that guy".

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20141217133711.440709691%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


DjangoCon Europe 2015

2014-12-17 Thread Daniele Procida
Hello everyone, here's DjangoCon Europe 2015: 

.

Hope to see you in Cardiff in June!

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20141217095509.715706034%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: Devils advocate question

2014-12-16 Thread Daniele Procida
On Tue, Dec 16, 2014, Sayth Renshaw  wrote:

>Why hasn't a cms been designed off django or python? A language cultural
>effect yoy would think python would be more stable than php/drupal.

You mean like django CMS, to Fein CMS, Mezzanine, Wagtail or any of the other 
Django CMSes?

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20141217075832.1415961390%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: Returning submitted formset data to the template for further editing

2014-07-01 Thread Daniele Procida
On Sat, Jun 28, 2014, Andrew Choi  wrote:

>It doesn't seem like there's an easier way to do what you're proposing. 
>However, what's the form data manipulation that you need to do for some of 
>these forms? Is there a way to separate that from the form set submission?

Each time the form is resubmitted to have the data processed, it needs to 
complete some fields based on others, and related data in the database.

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140702065808.1709193865%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Returning submitted formset data to the template for further editing

2014-06-27 Thread Daniele Procida
As far as I can tell, there doesn't seem to be an easy way to do this:

1.  bind POST data from the request to a formset
2.  loop over the forms in the formset
3.  for each form, manipulate some of the form data
4.  return the manipulated form data to the template
5.  in the template, have useful access to the forms' is_valid(), validation 
and so on

Form data are immutable, so can't be edited directly, so step 3 is difficult.

We could copy the immutable form data to make them editable, but since they are 
in one great big soup of a QueryDict and have prefixes, picking them out one by 
one for each form and field to edit them is messy and unpleasant.

We could instead process all the data in the usual way, then put each dict of 
form.cleaned_data into a new list, and create a new formset using 
my_formset=MyFormset(initial=all_my_cleaned_data_dicts), but now that's 
unbound, which makes step 5 is impossible.

I think the answer has to be to get all of the cleaned_data dicts; loop over 
the keys, add the prefixes to each one; dump the key/value pairs into a new 
data dict; grab the formset management key/values and transfer those too, and 
then do my_formset.data = my_new_data_dict.

But it seems like an awful lot of work for what must be a fairly usual use-case.

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140627152438.1830134201%40smtpauth.cf.ac.uk.
For more options, visit https://groups.google.com/d/optout.


Re: How to learn Django?

2014-06-15 Thread Daniele Procida
On Sun, Jun 15, 2014, Aadit Kapoor  wrote:

>How to learn Django?

 is the best place to 
start for information.

And then the best way to learn Django, as is the case with any tool, is to have 
a problem you want to solve with it, because that gives you a project to work 
on, some motivation, some boundaries, and a way to decide whether or not you 
have been successful.

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140615092858.135478391%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Python/Django users in Namibia

2014-06-14 Thread Daniele Procida
Is there anyone here from Namibia, or involved in Python/Django-related 
activities there, or who knows someone who is? 

Please get in touch with me if so, at dani...@vurt.org. It's about holding an 
international Python community event in Windhoek.

See  for some more information. A 
proposed three-day event in Namibia would be part of a larger collaboration 
between Cardiff University in Wales and the University of Namibia, but it's 
only possible if there's a local Namibian Python community ready to be involved.

Thanks,

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140614065403.91806461%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: OneToOne? Inheritance? Another solution for nested model relationships?

2014-05-28 Thread Daniele Procida
On Wed, May 28, 2014, Leonardo Giordani  wrote:

>I usually solve such issues with Inheritance. I feel comfortable with it
>because it lets me (in your example) to manage both ResearchStudent and
>ResearchStaff independently, while keeping the Researcher parent model
>available to deal with "global" queries and data interaction.

It it were a case where abstract inheritance would work, I would agree. 
Unfortunately, the Researcher model can't be abstract (because it has its own 
relations with Publications).

If I use multi-table inheritance, that solves part of the problem. However I 
don't know how well it would work if I have a Researcher, who at some point 
needs to be a ResearchStudent and maybe later becomes ResearchStaff.

Regards,

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140528123744.1377784185%40smtpauth.cf.ac.uk.
For more options, visit https://groups.google.com/d/optout.


OneToOne? Inheritance? Another solution for nested model relationships?

2014-05-26 Thread Daniele Procida
I've an application that's been happily running for a few years, that does this:

class Person(Model):
   # everyone's a Person

class Researcher(Model):
# a Researcher is Person who publishes research
person = models.OneToOneField(Person)

class Publication(Model):
author = models.ForeignKey(Researcher)


But this is no longer enough: now I also need to distinguish between 
Researchers who are research students and members of staff. Those who are 
students will need new fields such as "thesis_title" and "supervisors".

But, I will *still* need the Researcher class independently of the new 
ResearchStudent and ResearchStaff classes, because it's needed for 
Publication.author.

So now it might look something like this:

class Person(Model):
   # everyone's a Person

class Researcher(Model):
# a Researcher is Person who publishes research
person = models.OneToOneField(Person)

class ResearchStaff(Model):
   researcher = models.OneToOneField(Researcher)

class ResearchStudent(Model):
   researcher = models.OneToOneField(Researcher)
   supervisors = models.ManyToManyField(ResearchStaff)

class Publication(Model):
author = models.ForeignKey(Researcher)


How manageable is this going to be? Is there a better way of doing what I need 
to do, perhaps through inheritance?

Thanks,

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140526213320.1042853662%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


DjangoCon Europe 2014: absolute last (and brief) chance to get tickets

2014-04-29 Thread Daniele Procida
We have been able to make a few more tickets available for DjangoCon Europe 
2014.

This last batch of sales must close at the very latest 1700 CET today, 29th 
April: 
http://www.weezevent.com/evenement.php?id_evenement=53536&lg_billetterie=2 - 
and may need to close earlier.

If you would like a ticket and don't have one, get it now. Please don't be 
disappointed!

You can tell us about accommodation preferences at 
https://docs.google.com/forms/d/14cGjTjBpMRXNvtyafVEfHIvejnQCQQJFUEW4FX6wDqI/viewform,
 but please note that there are no more single rooms available.

Regards,

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140429110124.777639530%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: CSS not rendering correctly

2014-04-02 Thread Daniele Procida
On Wed, Apr 2, 2014, Warren Jacobus  wrote:

>I'm having some trouble with my css in my django app. See pic for how 
>things get rendered.

Restart your server, in case you introduced some key files after you last 
started it, or run collectstatic 
 
in case your static files (such as CSS) are not being served up properly.

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140402115258.592522277%40smtpauth.cf.ac.uk.
For more options, visit https://groups.google.com/d/optout.


DjangoCon Europe 2014

2014-03-27 Thread Daniele Procida
Djangonauts!

This year's DjangoCon Europe is taking place in mid-May, on its very own island 
off the coast of the French riviera.

If you're planning to come and don't yet have your ticket, you should act 
swiftly, because ticket sales must close on the 20th April.

If you haven't yet decided whether to attend, here are some reasons why you (or 
your partner/boss/employer) should consider it:

A DjangoCon is a wonderful opportunity to develop your skills and knowledge, 
not just through the three days of talks, but also through the conversations 
and meetings you'll have with a great congregation of other Django users.

Whatever your level of skill or experience, you're going to leave having 
learned new skills, discovered new tools and made new friends.

That's especially true this year, because as well as the talks 
, we are running a number of substantial  
tutorials , all aimed at improving your 
Django skills. The tutorials are all free. 

If one of the tutorials fills an important hole in your skill-set, you may find 
that it's worth the conference fee all on its own.

If you or your company are looking for new collaborators or new people for your 
team, you'll meet Django developers from all over the world here. Similarly, if 
you're looking for new opportunities, this is where emplyers come to offer them.

This year the conference fee - 670 Euros - covers *everything*: the conference 
itself, all your meals for three days, your accommodation for two nights - even 
the ferry to get to the island.

You can also purchase tickets separately for extra nights, if that helps with 
your travel plans, and to stay on for the sprints. You can even bring a 
companion with you, because an island with vineyards, a nature reserve and 
beautiful beaches is too special not to share.

There's information on the site about how to get to the island 
, but just ask - here, or via our website 
 if you need to know any more.

Hope to see you there!

Daniele, on behalf of the organising committee

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140327153817.656684178%40smtpauth.cf.ac.uk.
For more options, visit https://groups.google.com/d/optout.


Dutch Django Sprint in Amsterdam February 2014

2014-02-24 Thread Daniele Procida
The sprint this weekend was productive - Baptiste lists some commits at 
.

It was also a lot of fun. Thanks to Erik Romijn and the Dutch Django 
Association for organising it, and TravelBird  (they're 
recruiting by the way!) who supported the event and were excellent hosts. And 
of course, thanks to all the sprint participants.

I think there were sprinters who had travelled from at least half a dozen 
different countries. 

Don't miss the next one; it's highly recommended.

Thanks again to everyone who was involved.

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140224113335.1186523779%40smtpauth.cf.ac.uk.
For more options, visit https://groups.google.com/groups/opt_out.


Open day at Django Weekend Cardiff

2014-01-18 Thread Daniele Procida
Django Weekend Cardiff  is completely sold out.

Our open day remains open however, and you're invited to attend the numerous 
talks, tutorials and demonstrations in the programme.



There are fifteen different sessions in the open day programme, on all kinds of 
subjects. We may even be able to squeeze in a few more over the coming days.

All the sessions are free, and refreshments will be provided.

Registration is required so we know how many people to expect, and places in 
tutorials will be limited.

The sooner you register the better it is for us, because we have to plan 
catering, access and other practicalities - so please do it as soon as you can!

Register: 

One of the purposes of the open day is to showcase Django and Python to the 
local community - developers, researchers, government and business, school 
pupils and teachers. 

We are extremely grateful to the sponsors and supporters of Django Weekend 
, because they have made this open day 
possible, and to the numerous speakers and instructors who are presenting these 
sessions.

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140118170801.1422479461%40smtp.ntlworld.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django Weekend Cardiff - last call for talks and tutorials

2014-01-05 Thread Daniele Procida
The final deadline for porposals for talks and tutorials is the end of 7th 
January (GMT).



All Python/Django-related proposals are welcome.

We especially want proposals from:

* people who are minorities in the field
* first-time speakers

(in other words, the people who are less likely to speak at these events).

Remember, it's not just experts who have interesting things to say and share, 
and new perspectives are valuable to everyone.

Best of all, you'll be in front of the friendliest and most supportive audience 
a speaker could hope for.

If you are hesitating about making a suggestion, go ahead and make it. It 
doesn't have to be perfectly composed, it just has to give us a reason to think 
that you might have something interesting to say.

Or, please just ask us. We'll be very pleased to help you formulate your 
proposal or guide you in the right direction.

There'll also be opportunities for five-minute lightning talks. You don't need 
to register in advance; just put your name down on the day. Anything goes!

The last few tickets are still available for the event, if you haven't already 
signed up.

Regards,

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140105183701.2030251478%40smtp.ntlworld.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django Weekend Cardiff

2013-12-20 Thread Daniele Procida
As you may already be aware, tickets for Django Weekend Cardiff 
 sold out in three weeks.

If you were hoping to attend, please add your name to the waitlist as soon as 
possible: 



We know a lot of people are disappointed, and we are considering our options 
for moving the event to a larger venue. 

This is going to involve quite a lot of extra work, and it has budget 
implications too.

The more people who have signed up to the waitlist, the stronger the case for 
we have for doing that.

Another way to help make it easier for us is to step forward as a sponsor. Our 
sponsors are not a luxury or an extra, they are making the event possible. 

To give you an idea of what sponsorship means:

ticket price: £60
cost of meals and refreshments per attendee: considerably more than £60

In short, more attendees requires more sponsorship in order to maintain the 
same quality of experience.

Please keep an eye on our website for updates.

Many thanks for all the interest and support for this event from around the 
world.

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20131220090721.1278385825%40smtp.ntlworld.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Weekend Cardiff

2013-12-16 Thread Daniele Procida
On Wed, Nov 13, 2013, Daniele Procida  wrote:

>The UK's first-ever Django conference will take place on the 7th-9th
>February 2014 in Cardiff, Wales.
>
><http://djangoweekend.org>
>
>The programme for the event:
>
>Friday: tutorials and demonstrations (also open to the public)
>Saturday: talks
>Sunday: code sprints and clinics
>
>The conference is Django-focused, but all of all aspects of Python fall
>within its remit - particularly in the tutorials and workshops.

Tickets are on sale (the £50 early-bird tickets are nearly sold out). 

Tickets include meals and refreshments as well as other conference goodies.

We're accepting proposals for talks and tutorials. There'll be lightning talks 
too. We want a wide range of talks, so don't hestitate to submit a proposal.

We have a number of tutorials already confirmed:

*   Test-driven development
*   Building asynchronous applications with Tornado and Django
*   Getting started as a contributor to open-source projects

One of the aims of this conference is to create a big Django/Python/open-source 
software splash in Wales. Through our open-day activities we'll be showcasing 
Django and Python to local government and business, university researchers and 
students, local software developers and school teachers and pupils.

If you can put on a tutorial or demonstration that shows the power of 
Python/Django to one of these audiences, please drop us a line.

A number of Django core developers are already attending, and we hope more will 
confirm soon. They'll be there at the sprints and code clinics.

There are also several of super Django-using companies sponsoring the event.

There's information on international travel to Cardiff, discounted conference 
accommodation and other things to do while you're here all on our website: 
<http://djangoweekend.org>.

We hope to see you in Cardiff in February!

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20131216080749.584415959%40smtp.ntlworld.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django Weekend Cardiff - call for papers

2013-12-01 Thread Daniele Procida
Django Weekend Cardiff  - the first-ever Django 
conference in the UK -  will  take place from the 7th to the 9th February 2014, 
for three days of talks, tutorials, code sprints and clinics.
 
The conference is Django-focused, but all aspects of Python fall within its 
remit.

We invite members of the Python/Django communities to submit their talk and 
other proposals for the event: .

Talks
-

Do you have something to share with the rest of the community? Proposals on any 
subject are welcomed, at any level of technical expertise. Tell us about your 
experiments, discoveries, solutions, achievements and other adventures.



The deadline for proposals is the end of Monday 6th January 2014, GMT. Feel 
free to submit more than one!

Workshops & tutorials
-

The first day of this event will be dedicated to tutorials, workshops and 
demonstrations, some of which will be open the wider public.

Can you lead a tutorial, on a Python or Django topic? Can you demonstrate the 
power of Django to people who don't know about it? Do you have an application 
or product or service that you'd like to showcase?

Just let us know: . We're open to all kinds of 
suggestions, and especially ideas we haven't even thought of.

Sprints & clinics
-

No Django or Python event would be complete without code sprints. There'll be a 
Django sprint, led by at least a couple of core Django developers.

We'd like to get as many people as possible to stay for the sprints, and 
particularly new people who haven't taken part before. To encourage people to 
join in:

* we'll be supporting the sprints with a "Don't be afraid to commit" workshop 
on the tutorials day, aimed specially at those who would like to take part but 
aren't sure they have the skills - yet

* we'll be holding code clinics alongside the sprints, where you can put your 
questions or problems to a Python or Django expert

A particular clinic might run for minutes 45 or an hour or so. If you like to 
offer a clinic on a particular subject, or even a general one, please get in 
touch: . We'd love to hear from you.

On behalf of Django Weekend Cardiff,

Daniele


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20131201135804.622233590%40smtp.modern-world.net.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Call for Sponsors: Django Weekend Cardiff

2013-11-26 Thread Daniele Procida
On Sat, Nov 23, 2013, Daniele Procida  wrote:

>[With apologies to those who will inevitably see this message in more
>than one group or list.]
>
>In 2014 Cardiff will hold the first-ever Django conference in the UK.

<https://djangoweekend.org>

Tickets are now on sale!

There's information about travelling to Cardiff, accommodation and other things 
to do while you're here on the website.

Regards,

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20131126171530.1842819605%40smtp.modern-world.net.
For more options, visit https://groups.google.com/groups/opt_out.


Call for Sponsors: Django Weekend Cardiff

2013-11-23 Thread Daniele Procida
[With apologies to those who will inevitably see this message in more than one 
group or list.]

In 2014 Cardiff will hold the first-ever Django conference in the UK.



Django Weekend Cardiff will take place at Cardiff University in Wales 
, from the 7th to the 9th February, for three days of 
talks, tutorials, code sprints and clinics.

The conference is Django-focused, but all aspects of Python fall within its 
remit.

Django Weekend Cardiff is a Django/Python non-profit community event, organised 
and run entirely by unpaid volunteers.

The success of Python and Django community events relies upon the generosity of 
sponsors . Can you help?

Every penny received will go directly towards making this a better conference 
and improving the experience enjoyed by attendees.

Our sponsorship prospectus  
outlines some ways sponsors can get involved. If you'd like to be part of the 
event, please get in touch.

With thanks,

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20131123130829.992218798%40smtp.modern-world.net.
For more options, visit https://groups.google.com/groups/opt_out.


Django Weekend Cardiff

2013-11-13 Thread Daniele Procida
(With apologies if you have already seen this on another email list or 
newsgroup.)

The UK's first-ever Django conference will take place on the 7th-9th February 
2014 in Cardiff, Wales.



The programme for the event:

Friday: tutorials and demonstrations (also open to the public)
Saturday: talks
Sunday: code sprints and clinics

The conference is Django-focused, but all of all aspects of Python fall within 
its remit - particularly in the tutorials and workshops.

A venue has been booked at Cardiff University.

Registration and ticket sales will open soon, as well as a call for papers.

To be a success, the conference needs the support of:

*   people in Wales, the UK and beyond who will participate as attendees or 
volunteers
*   speakers who'd like to give talks or conduct tutorials
*   organisations locally and internationally willing to provide sponsorship or 
other support

If you can offer support, please get in touch.

One of the aims of the conference is to establish it as an annual event that 
will raise the profile in Wales of open-source software in general and  Python 
in particular, and also bolster the local open-source software community here. 

Above all, however, the intention is to establish the Django Weekend in Cardiff 
as a meaningful and enjoyable date in the Django/Python calendar.

We'll publish updates on our website, our Twitter account 
 and elsewhere as appropriate.

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20131113231127.943560890%40smtp.modern-world.net.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Complex query reduction

2013-11-02 Thread Daniele Procida
On Fri, Nov 1, 2013, Javier Guerra Giraldez  wrote:

>have you tried eliminating the second IN relationship?  something like
>
>entities = entity.get_descendants()
>
>items = BibliographicRecord.objects.filter
>(authored__researcher__person__member_of__entity__in=entities).distinct()

Indeed I have, but in that form it takes around 1770ms, compared to around 
1540ms in the original form. What I actually do is:

# breaking apart the queries allows the use of values_lists
entities = self.entity.get_descendants(
include_self=True
).values_list('id', flat=True)

# and the set() here is about 230ms faster than putting a distinct() on 
# the first query
researchers = set(Researcher.objects.filter(
person__entities__in=entities
).values_list('person', flat=True))

self.items = BibliographicRecord.objects.listable_objects().filter(
authored__researcher__in=researchers,
).distinct()

I think that's partly because this way the SELECT doesn't have to grab all the 
fields of publications_bibliographicrecord.

But, the real killer is the combination of ordering (in the queryset or on the 
model, it doesn't matter) with the distinct() - as soon as one is removed from 
the equation, the execution time drops to around 250ms.

That's for 55000 BibliographicRecords created by that last operation (before 
distinct() is applied; distinct() reduces them to 28000).

That seems excessive to me. 

BibliographicRecord has a custom primary key, and its id fields look like 
"d9ce7e2f-663e-4fc6-8448-b214c6915aed:web-of-science". Could that be implicated 
in performance?

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20131102145042.868061817%40smtp.modern-world.net.
For more options, visit https://groups.google.com/groups/opt_out.


Complex query reduction

2013-11-01 Thread Daniele Procida
I have been exploring a rather complex query:

# get all the MPTT descendants of entity
entities = entity.get_descendants()
 
# get all the Researchers in these Entities
researchers = Researcher.objects.filter(person__member_of__entity__in=entities)
 
# get all the BibliographicRecords for these Researchers
items = 
BibliographicRecord.objects.filter(authored__researcher__in=researchers).distinct()

In practice I use some tweaks (such as values_list) to speed this up, and 
caching, but the fundamental pattern is the same. It's slow, because there are 
30 thousand BibliographicRecords.

I'm trying to rearrange the construction of the query in different ways to find 
a speed improvement. I don't think that either prefetch_related or 
select_related will help here, but perhaps there are some other tools that 
would.

Any suggestions?

At  I've shown the SQL generated, and the models being 
used.

Thanks,

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20131101174524.207157947%40smtp.modern-world.net.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Please suggest me best e-tutorial for Django framework.

2013-10-17 Thread Daniele Procida
On Thu, Oct 17, 2013, rush  wrote:

>http://www.djangobook.com/ is also a good choice.

I would not recommend that actually. It's very out of date. 

Even the book itself says: "we ask that, at this time, djangobook.com not be 
used for educational purposes."

On the other hand, if people woud like help to bring it up to date...

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20131017122734.984289775%40smtp.modern-world.net.
For more options, visit https://groups.google.com/groups/opt_out.


Re: PyCons in Africa

2013-10-06 Thread Daniele Procida
On Fri, Oct 4, 2013, Nigel Legg  wrote:

>I have lived in both Zambia and Kenya, and have family in Zambia.  Bongo
>Hive in Lusaka may be a good place to start (they are on twitter). I
>haven't been there for more than five years, but would be interested in
>getting involved in some way, time and work permitting.

Hi Nigel, tahnks for the reply - 
.

Hope to see you there!

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20131006200837.712089333%40smtp.ntlworld.com.
For more options, visit https://groups.google.com/groups/opt_out.


PyCons in Africa

2013-10-04 Thread Daniele Procida
First of all, apologies if you have to read this more than once because of the 
cross-posting.

I've had an idea brewing recently.

I went to meet Professor Judith Hall this afternoon to talk about it. She's 
involved with http://medicine.cardiff.ac.uk/mothers-africa/ (amongst other 
things) and is working on a Cardiff University project which itself is part of 
http://wales.gov.uk/topics/health/improvement/index/grants/?lang=en

Following that meeting, I bashed out: 
https://github.com/evildmp/pycons-in-africa/ - please take a look, and even 
better, let me know what you think, or make your own contribution to the 
document. I'll continue working on it myself.

Thanks,

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20131004161344.532752077%40smtpauth.cf.ac.uk.
For more options, visit https://groups.google.com/groups/opt_out.


Cardiff Django users group

2013-09-28 Thread Daniele Procida
I'm starting a user group for Django developers in Cardiff, Wales.

Email list: 

The plan is to hold meetings monthly, probably on a Wednesday evening with 
occasional events on weekends. 

I'm trying to get a suitable venue with good wireless access organised at 
Cardiff University, but there are other options.

Daniele

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Ordering a queryset on a reverse foreign key's attribute

2013-08-01 Thread Daniele Procida
On Thu, Aug 1, 2013, Simon Charette  wrote:

>>From a quick look I'd also expect `order_by('-children__date')` to work.
>
>Can you provide the generated SQL query and some results?

I have in fact raised a ticket about this 
 which shows the generated sequel 
and describes the issue in more detail.

Maybe this is just a limitation of the ORM and should be noted more clearly in 
the documentation, or maybe it's behaviour that could be improved.

Daniele

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Ordering a queryset on a reverse foreign key's attribute

2013-08-01 Thread Daniele Procida
I have an Event model:

class Event(Model):
parent = models.ForeignKey('self', related_name='children')
date = models.DateField()

My question is: given a queryset of this model, how can I order it based on the 
Events' children's dates so that (say) Events with child Events with more 
recent dates are first?

(I thought that 

.order_by('-children__date')

might be a start, but in fact that seems to do something very odd to the items 
in the list, which I am looking at separately).

Thanks,

Daniele

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: .filter() and .exclude() don't add up

2013-07-30 Thread Daniele Procida
On Mon, Jul 29, 2013, akaariai  wrote:

>> I understood that part. But by "more general" I mean one that will work 
>> for any case, without having to know where the Nulls might be. 
>>
>> So given queryset A, and its subset queryset B, we can place B against A 
>> and obtain its complement. 
>>
>> Or to put it another way: give me all the items in A that are not in B. 
>>
>
>You can do this with a subquery in Django. non_red_things = 
>queryset.exclude(pk__in=red_things). If this performs well is a different 
>thing.

It seems to take about twice as long to execute, so no, it doesn't perform very 
well.

>I think that in SQL one can use WHERE (original_condition) is not true; 
>which will match both unknown (null comparison's result) and false in the 
>original condition.

But this isn't available as a Django query, without using raw SQL?

Daniele

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: .filter() and .exclude() don't add up

2013-07-28 Thread Daniele Procida
On Sat, Jul 27, 2013, Steve McConville  wrote:

>Perhaps I'm not sure exactly what you mean by "more general", but I
>was recommending something like
>
>red_things = queryset.filter(Q(color="red"))
>non_red_things = queryset.filter(~Q(color="red") | Q(color__isnull=True)
>
>This will produce SQL like
>
>SELECT * FROM queryset WHERE color IS 'red';
>SELECT * FROM queryset WHERE color IS NOT 'red' OR color IS NULL;
>
>The set non_red_things will be the complement of red_things.

I understood that part. But by "more general" I mean one that will work for any 
case, without having to know where the Nulls might be.

So given queryset A, and its subset queryset B, we can place B against A and 
obtain its complement.

Or to put it another way: give me all the items in A that are not in B.

Daniele



-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: .filter() and .exclude() don't add up

2013-07-27 Thread Daniele Procida
On Fri, Jul 26, 2013, Steve McConville  wrote:

>> So, if one of the fields can be Null, then *neither*:
>>
>> queryset.filter(field=value)
>>
>> queryset.exclude(field=value)
>>
>> will match a record where it's Null?
>
>As I understand it, this is correct - it's certainly the way SQL was designed.
>
>> In that case, is there a better - more reliable - way than using
>both .filter() and .exclude() with the same terms to split a queryset
>into all those items that match a filter, and all those that don't?
>
>As well as doing the queries above, you can get the nulls by doing
>
>queryset.filter(field__isnull=True)

I meant is there a more general way of doing something like:

red_things = queryset.filter(colour="red") # get red things

non_red_things = queryset - red_things # get all other things

Maybe this simply isn't possible in SQL.

Daniele

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: .filter() and .exclude() don't add up

2013-07-27 Thread Daniele Procida
On Fri, Jul 26, 2013, Bill Freeman  wrote:

>You really should figure out which record isn't showing up in either sub
>case and look at it in detail to see if NULLs are involved before you spend
>time trying to fix a problem that you don't have.
>
>You could, for example collect all the ids from the several queries into
>python sets, union the sub queries, and take the difference of that from
>the total query.

Thanks, after a bit I got hold of the field=Null items, which were appearing 
unexpectedly in an earlier queryset.

Danie

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: .filter() and .exclude() don't add up

2013-07-26 Thread Daniele Procida
On Fri, Jul 26, 2013, Steve McConville  wrote:

>Firstly (and I don't think this is the cause of the problem) you're
>calling datetime.now() four times, which will give you four different
>datetimes (ie. the queries will not be completely identical).

Good point, I will address that.

> Secondly
>SQL uses a 3-valued logic (with null) so if any of the fields you're
>filtering on are nullable you may not be able to rely on the law of
>the excluded middle

So, if one of the fields can be Null, then *neither*:

queryset.filter(field=value)

queryset.exclude(field=value)

will match a record where it's Null?

In that case, is there a better - more reliable - way than using both .filter() 
and .exclude() with the same terms to split a queryset into all those items 
that match a filter, and all those that don't?

Thanks,

Daniele

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




.filter() and .exclude() don't add up

2013-07-26 Thread Daniele Procida
How is this possible?

# we start with a queryset actual_events

# get forthcoming_events using filter()

forthcoming_events = actual_events.filter(  
Q(single_day_event = True, date__gte = datetime.now()) | \
Q(single_day_event = False, end_date__gte = datetime.now())
)

# get previous_events using exclude() and exactly the same terms as above

previous_events = actual_events.exclude(  
Q(single_day_event = True, date__gte = datetime.now()) | \
Q(single_day_event = False, end_date__gte = datetime.now())
)

# And now:

# actual_events.count():  467
# forthcoming_events.count():  24
# previous_events.count():442

SInce I have run .filter() and .exclude() with identical terms, should they not 
between them contain all the items in the queryset they acted upon, *whatever* 
the terms used?

Daniele

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Friendly browsing through categories

2013-06-03 Thread Daniele Procida
I am developing an application (for managing a variety of learning/training 
resources) each of which is catalogued in various ways - type, audience, 
topic(s), domain(s), cost, and so on.

I have the Django application's models and structures built, and I have begun 
populating it with data, I'd like to offer a friendly interface for browsing 
the resources.

What do you suggest, or where do you suggest starting? I am not even sure what 
to look for.

Thanks,

Daniele

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




Re: Workshop: Don't Be Afraid to Commit, Cardiff, UK

2013-05-31 Thread Daniele Procida
On Fri, May 31, 2013, Rahul Ramesh  wrote:

>I think what you're doing is really great. Do you have recorded videos
>available online or do you plan to record your next session? It'd be great
>for people like me who can't attend the workshop.

I don't think that a recording of it would work well, but the tutorial 
documentation  should work 
just as well without me. 

Everything in the workshop's in there, and I wrote it all step-by-step. You 
could try that. From the start the idea was that people should be able to use 
the document as an alternative to attending the workshop.

I'm on the #django irc channel on irc.freenode.net most of the time, as either 
EvilDMP or SuperDMP, so feel free to call on me for help if you need it.

Daniele

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




Workshop: Don't Be Afraid to Commit, Cardiff, UK

2013-05-30 Thread Daniele Procida
I'm running a Don't Be Afraid to Commit in Cardiff weekend after next, under 
the auspices of the Cardiff Dev Workshop.

It's a workshop/tutorial for Python/Django developers who would like to
contribute to the projects they use, but need more grounding in some
of the tools required.

I ran this at the DjangoCon Europe sprints in Warsaw a couple of weeks ago, and 
it seemed to work pretty well there, 

See  for more information.

The workshop will take participants through the complete cycle of
identifying a simple issue in a Django or Python project, writing a patch
with tests and documentation, and submitting it.

The workshop is aimed at the first-time committer. Very little experience
is required: 


It's free to anyone who'd like to attend, but you need to register because 
places are limited: .

Regards,

Daniele

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




Re: IdeaScale-alike DJango applications

2013-05-23 Thread Daniele Procida
On Thu, May 23, 2013, Russell Keith-Magee  wrote:

>On Wed, May 22, 2013 at 6:53 PM, Daniele Procida  wrote:
>
>> Are there any Django applications that do the same thing as <
>> http://ideascale.com>?
>>
>> IdeaScale basically seems to be a way for users to submit proposals, and
>> have them voted up and down by other users; like polls, but in a web
>> 2.1beta kind of way.


>Are you looking for an app that implements ideascale-like ideas for your
>own purposes, or are you suggesting an ideascale-like framework to drive
>Django development?
>
>If it's the former, then you're really just looking at tying something
>contrib.comments (or equivalent) and django-voting to a model that
>represents an "idea".

Yes... but I'm wondering whether someone has done all the hard work, tying all 
the bits together, making it look pretty, all the extra stuff (ponies, moon on 
a stick, etc).

I have found <https://github.com/cfpb/idea-box>, that looks worth investigating.

>If you're talking about the latter, then it's possible to use CC counts or
>comment counts as an approximation of interest in a topic; but it might be
>interesting to see a literal "I want this" vote count associated with
>tickets.

Vote early and vote often!

Regards,

Daniele

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




IdeaScale-alike DJango applications

2013-05-22 Thread Daniele Procida
Are there any Django applications that do the same thing as 
?

IdeaScale basically seems to be a way for users to submit proposals, and have 
them voted up and down by other users; like polls, but in a web 2.1beta kind of 
way. 

It's something I've been asked about.

Any suggestions?

Daniele

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




Python/Django DevOps community and resources

2013-05-20 Thread Daniele Procida
Hi folks. I've just got back from the most astounding DjangoCon Europe in 
Warsaw, where several of decided that the DevOps in the community needed more 
mutual support.

So, we've set up #django-devops on irc.freenode.net, and 
 for an email list.

Do join us if this sort of thing is your concern.

Daniele

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




Re: cant syncdb with postgresql

2013-04-25 Thread Daniele Procida
On Thu, Apr 25, 2013, Pedro Silva  wrote:

>installed apps:
>'django.contrib.auth',
>'django.contrib.contenttypes',
>'django.contrib.sessions',
>'django.contrib.messages',
>'django.contrib.staticfiles',
>'django.contrib.admin',
>'django.contrib.admindocs',
>'psycopg2.extensions',
>#my app
>'meetpop.meet',
>#more info at https://code.google.com/p/gsettings/wiki/API
>'meetpop.gsettings',
>#django logging view helper
>'django-log-file-viewer',
>#custom template tags 
>'meetpop.meet.templatetags',
>
>its fresh, i can create a fresh sqllite db with no probs.

I would suggest trying it with only the django.contrib apps, and nothing else.

If that doesn't work, then I don't know what to suggest.

Daniele 

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




Re: cant syncdb with postgresql

2013-04-25 Thread Daniele Procida
On Thu, Apr 25, 2013, Pedro Silva  wrote:

>I cant sync db with heroku postgresql, with sqllite works great.
>Can anybody help me?
>requeriments:
>Django==1.4.5
>PIL==1.1.7
>distribute==0.6.36
>dj-database-url==0.2.1
>django-db-log==2.2.1
>django-log-file-viewer==0.4
>psycopg2==2.5
>virtualenv==1.9.1

Can you list what you have in INSTALLED_APPS?

And, are you doing your syncdb on an empty database, or one with data already 
in it?

Daniele

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




Django Inspector - Inspects and reports on Django sites

2013-04-15 Thread Daniele Procida
If like me you're responsible for a large and sprawling site, maintained by 
several dozen users, and you feel you don't know enough about what's going on 
in it you might find  useful.

I discovered a few interesting things the first time I ran it, including some 
fabulous URL paths:

/primary-care-public-health/research/south-east-wales-trials-unit/sewtu-what-we-do/full-sewtu/sewtu-star-trialstudy/sewtu-starinfo/

as well as some obscure pages that I hadn't realised were throwing exceptions.

Daniele

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




Django Form Designer

2013-03-07 Thread Daniele Procida
I like and use Django Form Designer, 
, but it hasn't been updated 
for a while and needs some work.

For example, it needs better docs and tests, while there are a number of 
outstanding pull requests.

I'm hoping to hear back from Samuel Luescher, the author, about his plans for 
it (if any).

In the meantime, is anyone else maintaining and updating a fork that I should 
contribute to? There's  for 
example.

Daniele

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




Re: On the fly image resize

2013-02-04 Thread Daniele Procida
On Sat, Feb 2, 2013, nYmo  wrote:

>I'm new to django and also python but have already some programming 
>experience. I'm currently creating my first application in django and get 
>stucked because I'm looking for the best way to resize uploaded images.
>I'm already so far that I can upload/delete/update my images and show them 
>in my view. Now I want to resize the images for my view and thought about 
>the best way?
>
>First question: Is it possible to resize the images on the fly? For example 
>I uploaded an image in 1920x1080px and now want to transform it to 400x200 
>or something similar when the view is being loaded? Is this a convenient 
>way in django or not?

It's certainly possible.

I recommend , which is robust and 
well-supported.

Once it has resized an image for you, it will serve up the resized file, until 
something changes (such as the dimensions you require), in which case it will 
create a new copy at the size you want.

It's fast enough at resizing images on the fly that I am often not sure whether 
it is returning an image it has previously resized for that page, or is doing 
it right now. 

I use it with Django Filer, which manages uploaded images. 
. Amongts other things Django 
FIler allows you to mark the part of the image that is important, so that if 
the image is cropped, the important part will not be cut out.

I also use it as part of some other Django software that inspects its own 
templates as they are being rendered, and is able to calculate the corrct size 
of an image wherever it's being placed. Even with all this going on, it seems 
perfectly fast enough to use on the fly.

Daniele

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




Share an apartment in Warsaw for DjangCon Europe

2013-02-01 Thread Daniele Procida
I am hoping to go to DjangoCon in May, arriving 14th departing 19th or 20th 
after the sprints. 

Finances are tight - I am looking into apartments, which might be cheaper and 
more comfortable than a hotel. If anyone else is doing the same and would like 
to share, please drop me a line.

Thanks,

Daniele

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




"Add another [inline item]" and custom widgets with JavaScript

2013-01-24 Thread Daniele Procida
I work with a rather complex autocomplete widget for admin that works with 
generic foreign keys (select the content type, then you can do an autcomplete 
search for the item).

The problem is that it breaks when you "Add another [inline item]" in the admin 
- the issue raised in .

It breaks because of the way it works. 

Each instance of the widget:



 

renders to a template:



 

that then uses:




to create the  field with the autocomplete magic attached to it.

However, "Add another [inline item]" stores and then copies an empty hidden 
item, and this is in effect born crippled, with "__prefix__" in its ids instead 
of the usual item number - it gets duplicated without the JavaScript classes.

I can see that the way the widget uses a template with inline JS is a 
complication, and I have tried reworking it in various ways so that the JS is 
called just once for all instances in the entire document, but to no avail so 
far.

What would be a sensible way forward with this generic fk autocomplete? It's a 
very nice one in other respects, that returns useful metadata and thumbnail 
images and so on in its autocomplete search results, but I just can't see how 
to reconcile the way it works with the way "Add another [inline item]" works.

Thanks for any suggestions,

Daniele

-- 
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.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Custom jQuery in admin

2013-01-11 Thread Daniele Procida
I had a custom widget, which broke after some other things were updated.

It was saying:

TypeError: 'undefined' is not a function (evaluating '$('#id_conta
cts_and_people-phonecontact-content_type-object_id-0-label').combo
box()')

Last night, I finally managed to fix it, after noticing that this script (which 
is injected into the HTML body as many times as required for each widget) began:

$(document).ready(function(){

while others I had seen began:

jQuery(document).ready(function($){

Changing it to the latter form made it work.

The only thing is, I don't really understand what was wrong, or how doing that 
fixed it.

I understand that a jQuery conflict of some kind meant that jQuery was unable 
to find the function "combobox()" and that probably this was because of the way 
the admin template was loading JavaScript files. 

But I don't understand what the changes actually mean, or what they do.

I also found that:

django.jQuery(document).ready(function($){ 

worked. Again, I don't know what that is doing.

If someone can explain what is going on in this example, that would be really 
helpful.

More generally, this sort of thing (jQuery conflicts) seems to be an almost 
constant issue for Django developers who create custom widgets. Is there a more 
general strategy for dealing with it?

Thanks,

Daniele

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



Don't be afraid to commit - a free Python/Django workshop (Cardiff, UK)

2013-01-11 Thread Daniele Procida
I have made a combined talk/workshop proposal for DjangoCon Europe in May (all 
proposals at ).

I want to run the workshop part a couple of times before taking it to Warsaw 
(assuming the proposal is accepted, but it's worth doing anyway). 

The workshop is free and open to anyone - so if you're interested and within 
reach, let me know. 

=
Don't be afraid to commit
=

A hands-on workshop for Python/Django developers who would like to contribute
more to the projects they use, but need more grounding in some of the tools
required.

What's in it for you


As well as helping to put you in a position to commit successfully to
collaborative projects, the workshop's emphasis on using virtualenv/pip and
git will help you manage your own work in a more streamlined and efficient
way.

The automated testing tutorial - the most substantial component of the workshop
- will help you develop your software faster, better and more easily.

What we'll cover


The workshop will take participants through the complete cycle of identifying
a simple issue in a Django or Python project, writing a patch with tests and
documentation, and submitting it.

The workshop will take you through the use of:

* virtualenv and pip
* git (and GitHub)
* running and writing tests for Python applications
* writing and building documentation using Sphinx
* submitting a pull request

A workbook and reference guide will be provided to support the workshop.

What you need to know
=

The workshop is open to anyone, but places will be limited.

Date: a weekday morning or afternoon in February or March 2012
Venue: Cardiff University
Attendance fee: none

Let me know if you'd like to attend!

Daniele


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



DjangoCon Europe 2013 call for papers

2012-12-11 Thread Daniele Procida
DjangoCon Europe http://2013.djangocon.eu will be held in Warsaw from the 
15th-19th May 2013 (three days of talks followed by two of sprints and 
workshops).

The organisers are very pleased to invite members of the Django community to 
submit their talk proposals for the event.

We're looking for Django and Python enthusiasts, pioneers, adventurers and 
anyone else who would like to share their Django achievements and experiments 
with the rest of the community.

We are particularly keen to invite submissions from potential speakers who have 
not previously considered speaking at an event like this - so if you haven't, 
please consider it now!

We really look forward to hearing from you all, and seeing you in Warsaw next 
May. 

For more information, see 
http://blog.djangocircus.com/post/36590674298/call-for-speakers. 

This call for papers closes on January 8th 2013.

Powodzenia!


Daniele, on behalf of the DjangoCon Europe organising committee.

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



Tests tutorial for djangoproject.com

2012-11-07 Thread Daniele Procida
I have done some work on writing up a tutorial for testing (part 5 of the 
existing tutorial, in effect).

My draft so far:




I'd really appreciate feedback, on any aspect (accuracy, style, terminology, 
good practice, whatever) of this.

Trac ticket is .

Thanks,

Daniele

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



Calculated attributes of ModelAdmin classes

2012-10-19 Thread Daniele Procida
I have a ModelAdmin class. 

Sometimes, I want it to include a certain field in the fieldsets, and sometimes 
I don't (whether it does or not would be the result of a calculation on the 
instance that is being edited in the admin). 

How can I make the fieldsets attribute a calculated value, calculated each time 
a different instance is loaded in the admin?

Another example: I might want a certain field to be a readonly_field - 
sometimes.

Is this possible? 

I have a feeling it won't be, because:

*   attributes like fieldsets and readonly_fields are set up in the __init__()
*   once set up, they don't seem modifiable
*   the __init__() doesn't have access to the instance, so use that to 
determine the attributes

Daniele

-- 
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: Better feedback for admin users

2012-10-19 Thread Daniele Procida
On Thu, Oct 18, 2012, Marc Aymerich  wrote:

>On Wed, Oct 17, 2012 at 12:21 AM, Daniele Procida  wrote:
>> I am starting to customise the admin classes for my models so that I
>can provide extra feedback to the user.
>>
>> For example I want to report - in the admin page - useful information
>about how the system will interpret the current state of the object
>being edited.
>>
>> I'm doing this by using readonly_fields, that contain the output of
>method on the ModelAdmin class, a bit like this:
>>
>> class PersonAdmin(ModelAdmin):
>> readonly_fields = ['check_address',]
>>
>> def check_address(self, instance):
>> return instance.get_full_address or "class='errors'>Warning: I am unable to work out an address for this
>person."
>>
>> (the actual examples are rather more complex, but this is the idea).
>>
>> Does a more elegant way of doing this exist, either in Django's core
>already, or using some package that makes it easier?
>>
>
>don't know for a best way, but for me the one you're describing its
>actually a good workaround that maybe I'll use :)
>thanks for sharing !

You're welcome!

Note that you can also use methods of the Model as readonly_fields, but you 
can't use properties (because you can't assign attributes to the properties 
that you might need, like:

check_address.short_description = "Address" # a bit like verbose_name
check_address.allow_tags = True # so you can use HTML in the output

).

It would maybe be nicer to be able to use properties, for me anyway, since 
really these are attributes of the model class, and might also want to use 
elsewhere.

Daniele

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



Better feedback for admin users

2012-10-16 Thread Daniele Procida
I am starting to customise the admin classes for my models so that I can 
provide extra feedback to the user. 

For example I want to report - in the admin page - useful information about how 
the system will interpret the current state of the object being edited. 

I'm doing this by using readonly_fields, that contain the output of method on 
the ModelAdmin class, a bit like this:

class PersonAdmin(ModelAdmin):
readonly_fields = ['check_address',]

def check_address(self, instance):
return instance.get_full_address or "Warning: 
I am unable to work out an address for this person."

(the actual examples are rather more complex, but this is the idea).

Does a more elegant way of doing this exist, either in Django's core already, 
or using some package that makes it easier?

Thanks,

Daniele

-- 
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 testing strategy

2012-10-10 Thread Daniele Procida
On Thu, Oct 4, 2012, Daniele Procida  wrote:

>I have started writing my first tests, for a project that has become
>pretty large (several thousand lines of source code).

>I'd appreciate any advice.

Many thanks for the advice and suggestions.

This is what I have produced so far: 
<https://github.com/evildmp/Arkestra/blob/develop/contacts_and_people/tests.py>

At the moment, all the tests (they are testing methods on a particular set of 
models) are in a single class and even a single test function. I want to break 
them up, to make them more manageable.

What would be a good way to do that? I will need the objects I set up available 
in lots of different test functions, and probably different test classes too.

For example, I would like to write some tests for views, and to test based on 
the objects I have created so far.

Daniele

-- 
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 testing strategy

2012-10-05 Thread Daniele Procida
On Thu, Oct 4, 2012, Evan Brumley  wrote:

>django-dynamic-fixture can also help a lot in this situation:
>http://paulocheque.github.com/django-dynamic-fixture/
>
>Certainly beats having to futz around with fixtures.

Thanks - there seem to be a lot of tools to generate test data in various ways, 
such as .

However I am still puzzled by the question at a slightly higher level, about 
strategy - is it better to create a large collection of data once, and to test 
the behviour of the system against the various combinations of data in it, or 
to create a lengthy succession of smaller collections of data,containing only 
the material needed for the particular combination being tested each time?

Daniele

-- 
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 testing strategy

2012-10-04 Thread Daniele Procida
I have started writing my first tests, for a project that has become pretty 
large (several thousand lines of source code).

What needs the most testing - where most of the bugs or incorrect appear emerge 
- are the very complex interactions between objects in the system.

To me, the intuitive way of testing would be this:

* to set up all the objects, in effect creating a complete working database
* run all the tests on this database

That's pretty much the way I test things without automated tests: is the output 
of the system, running a huge database of objects, correct?

However, I keep reading that I should isolate all my tests. So I have had a go 
at creating tests that do that, but it can mean setting up a dozen objects 
sometimes for a single tiny test, then doing exactly the same thing with one 
small difference for another test.

Often I have to run save() on these objects, because otherwise tests that 
depend on many-to-many and other database relations won't work.

That seems very inefficient, to create a succession of complex and 
nearly-identical test conditions for dozens if not hundreds of tests.

I'd appreciate any advice.

Daniele

-- 
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 and PHP webhosting in Germany

2012-06-17 Thread Daniele Procida
On Sun, Jun 17, 2012, Mike Ryan  wrote:

>Does anyone else feel that "which webhost..." questions should be politely 
>responded to with a link to  
>https://code.djangoproject.com/wiki/DjangoFriendlyWebHosts, and a request 
>not to post similar questions in future?

Not really, it seems a perfectly relevant question, and a sensible way to get 
and give up-to-date advice based on personal experience.

Daniele

-- 
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 and PHP webhosting in Germany

2012-06-16 Thread Daniele Procida
On Sat, Jun 16, 2012, sjtirtha  wrote:

>can somebody recommend a good and cheap web hosting for django and
>php(wordpress)?
>I'm looking something below 10 ? monthly, only for small apps and blogs.

 have worked well for me; they are inexpensive and 
the support is quick and friendly.

Daniele

-- 
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 add Google Map Markers With Django Template Tags

2012-05-31 Thread Daniele Procida
On 31 May 2012, at 21:21, DF wrote:

That's interesting, but mine seems like it could be less involved. This is what 
I attempted, which failed:

http://dpaste.org/55T9x/

Well, you don't need all the other stuff I discussed, but the key thing is: 
given some variable (in my example it was place.site.maps) containing a 
collection of places with lat/long information, you may be able to use my 
template to do what you need with a little tweaking.

Daniele

-- 
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 add Google Map Markers With Django Template Tags

2012-05-31 Thread Daniele Procida
On Thu, May 31, 2012, DF  wrote:

>Any insight on how to properly loop through items in a stored Django object 
>with lat, lon info and place these on a Google Map using the API would be 
>very appreciated.

I do it like this:



The view for that template is:



It provides the template with the place; the place ("Building" in the models, 
before I realised I needed to be concerned with places that were not actual 
buildings) will belong to a Site. Each Site can have one or more Buildings 
(i.e. places), each of which might have a map.

The Site.maps property in:



contains a list of Buildings that should have a map for each Site.

The template loops over all those buildings to produce the map, right here:



Results look for example like:



or

.

However many items are on the map, it will scale to fit them in its bounds.

Let me know here or on irc://irc.freenode.net/arkestra if you need more 
information.

Daniele

-- 
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: Taggit fragmentation

2012-05-29 Thread Daniele Procida
On Tue, May 29, 2012, Marcin Tustin  wrote:

>That's not quite right. Once you build up a reputation as the package to
>have, if you don't at least hand over the project, you expose everyone to
>the pain of figuring out how to either use your code, or which is best
>place to get a forked version. It's certainly not hard to see that there
>are people who want to take this over, and it's better to let *someone* do
>that then leave the project to moulder and splinter.

No-one needs to hand it over; if someone wants to, they can take it over. 

The project doesn't need an anointed successor to carry its flame.

Daniele

-- 
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: Taggit fragmentation

2012-05-29 Thread Daniele Procida
On Tue, May 29, 2012, Simon Bächler  wrote:

>I believe that if you publish a repo and you are the main contributor
>then it is your responsibility to maintain it. 

That seems to be asking a bit much, frankly.

Don't forget that one way for Alex (or whoever) to meet the obligations you set 
out for publishers of open source software would simply be not to publish it. 

He could delete his repo, freeing himself from the responsibility to mantain it.

To whose advantage would that be?

>If you don't have time,
>then hand it over to someone else  or just give someone else the rights
>to push into your repo. I'm not asking Alex to fix all bugs himself,
>because most of the bugs have already been fixed by other people. He or
>someone with the rights to his repo just has to review the code and
>merge the pull requests, or deny them and guide the helper to a better
>solution. That would not take too long.

You could do all that yourself, couldn't you?

Daniele

-- 
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: Where are the women?

2012-05-21 Thread Daniele Procida
On Tue, Apr 24, 2012, Daniele Procida  wrote:

><http://2012.djangocon.eu/schedule/involving-women-in-the-community/> -
>and then I had a closer look at the names of this year's speakers.
>
>There are *two* women out of the 24 or so speakers listed, and only one
>is doing a solo talk.

An update - the keynote speakers have all been announced now, and two of the 
three are women:

Jessica McKellar 
<http://2012.djangocon.eu/blog/announcing-our-second-keynote-speaker-jessica-mcke/>
 is a Python Software Foundation board member and a maintainer of several 
important open source Python projects.

Karen Tracey 
<http://2012.djangocon.eu/blog/announcing-our-final-keynote-speaker-karen-tracey/>
 is a core Django developer and author of Django Testing and Debugging.

which is really excellent and certainly helps address the imbalance.

Two weeks to go!

Daniele

-- 
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: Where are the women?

2012-04-25 Thread Daniele Procida
On Wed, Apr 25, 2012, Hanne Moa  wrote:

>On 24 April 2012 16:14, Daniele Procida  wrote:
>> I was looking at <http://2012.djangocon.eu/schedule/> again with
>excited anticipation, and reading through the talk summaries.

>> There are *two* women out of the 24 or so speakers listed, and only
>one is doing a solo talk.

>You get more women in by changing the weights in *any* of the tests:
>more programmers, more female programmers, more open source
>programmers, more programmers visiting techie cons etc. It adds up.
>
>So: you have this wee group of potential "female open-source
>programmer that visit techie cons that also are of interest to you".
>Then, and only then can you start to look at con-specific or
>language-specific tests that the community can directly do something
>with: "bro"grammers, strip shows, excessive drinking and pressure to
>drink (rumored to be a problem at Java Script venues), rock star
>behavior (ruby?), specific idiots that should never have been left out
>of the asylum and ruins it for everyone etc.

The Python/Django culture just isn't like that. The days and evenings I spent 
at DjangoCon in Amsterdam last year were in the company of pleasant, courteous 
and friendly people.

I wasn't entirely sure what to expect before I went, but I didn't imagine 
there'd be strippers and heavy drinking - is that usual? Or what people expect, 
and are put off by?

>I haven't heard any rumors of stupid behavior among pythoneers or at
>python cons though so it might just be that "female open-source
>(python and django) programmer that visit techie cons that also are of
>interest to you" is a very small group.

It clearly is a very small group. The question is, why so small, and what, if 
anything, to do to address it.

Daniele

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



Where are the women?

2012-04-24 Thread Daniele Procida
I was looking at  again with excited 
anticipation, and reading through the talk summaries.

 - and 
then I had a closer look at the names of this year's speakers.

There are *two* women out of the 24 or so speakers listed, and only one is 
doing a solo talk.

This is absolutely not a comment about or criticism of the organisers; apart 
from anything, I know that they're aware of and concerned about the issues. 
They can only select proposals they've been given, or have attendees who sign 
up.

At last year's DjangoCon Europe, there were few women attending. At PyCon UK 
last year, there was a similar dearth. Someone remarked to me then that a 
Microsoft event there would be a much more equal distribution. 

So where are the women?
 
Does open source put women off? Is it something in the open source community, 
or the personalities you find in it? The nature of these conferences?

It's true that some open software communities, and the people in them, are 
pretty unwelcoming to newcomers, or seem to delight in expressing agressive and 
macho attitudes, but Python and Django are clearly not like that (quite the 
opposite in fact).

The conferences I've attended have been relaxed, warm and friendly. The worst 
you could say is that they are a little bit nerdy, which as a complaint would 
be like saying that medical conferences tend to be a little bit doctory.

The last thing I want is for a woman to read this (there won't be that many 
reading in any case, I suppose) and decide not to go because she doesn't like 
the thought of finding herself one person in ten; but from what I understand 
she's one in ten in the workplace and in the industry anyway.

I assume that most people agree this is a problem and worth addressing, but 
perhaps I'm wrong.

If women are not part of the community, or not coming forward to do things like 
give talks at - or even simply attend - its conferences, what if anything 
should be done about it?

Daniele

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



DjangoCon Europe Early Bird registration

2012-03-28 Thread Daniele Procida
Just a reminder - you only have a couple of days left to register at the Early 
Bird rate.



Also, I challenge you to find cooler accommodation in Zürich than I have:



Daniele

-- 
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, nginx, Passenger

2012-03-02 Thread Daniele Procida
We're having a devil of a time with our new server, which went live yesterday 
after two months of testing.

Every so often, nginx will display a 502 gateway error page, and something like 
this will appear in the logs:

2012/03/02 18:05:38 [error] 29743#0: *1479 upstream prematurely closed 
connection while reading response header from upstream, client: nn.nn.nn.nn, 
server: nn.nn.nn.nn, request: "GET /some/path/ HTTP/1.1", upstream: 
"passenger:unix:/passenger_helper_server:", host: "example.com"

This only occurs on some pages, but once it has happened on a page, it seems to 
keep happening.

It doesn't happen straight away - the server can run happily for some time 
before the errors start occurring.

The pages that trigger the error don't seem to be particularly hard work for 
the server. However, the same pages can be expected to trigger it, while some 
never do.

Merely restarting nginx doesn't get rid of the errors - they come back again.

As soon as DEBUG = True is applied in settings and nginx restarted, the errors 
disappear.

Some things that seem to have improved matters:

* increasing somaxconn to 1024
* turning off cacheing

In fact after turning off cacheing it was some hours before the errors returned.

We are running nginx, with a passenger_wsgi.py file setting up the path and 
pointing to the settings.py file.

I'd appeciate any tips on what the problem might be, or how to go about 
isolating it.

Obviously an error that occurs under heavy load is not unusual, though I don't 
think the load is particualrly heavy (and this server has taken over from one 
rather less powerful that has been doing the same job for two years).

What is puzzling is the error that occurs only on particular apparently 
arbitrary pages, and then persists, even after the load conditions (we were 
using ApacheBench to test) have disappeared.

Daniele

-- 
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 and its MySQL databases

2011-11-23 Thread Daniele Procida
My old database's tables were MyISAM. On my new server, MySQL by default uses 
InnoDB, which I understand is preferable.

However, when I ask Django tp a new table, on a database on the new server 
(which still contains lots of MyISAM tables imported from the old database) it 
creates them with foreign key contraints.

They then don't work. I can't save or do anything with them, without provoking 
errors like:

(1452, 'Cannot add or update a child row: a foreign key constraint fails 
(`pre2_test`.`cmsplugin_imagesetplugin`, CONSTRAINT 
`cmsplugin_ptr_id_refs_id_9346966b4b4d8e9` FOREIGN KEY (`cmsplugin_ptr_id`) 
REFERENCES `cms_cmsplugin` (`id`))')

If I delete the constraints in the database, then everything works again, even 
if I leave the tables as InnoDB.

So how to proceed from here?

If InnoDB is going to be difficult about foreign key relations, as 
 
suggests, then I'd prefer to use MyISAM, which I guess means working out how to 
reconfigure MySQL.

It has been suggested to convert all the tables to InnoDB: 
.

I don't know if that will solve the problem, but even if it does, then 
presumably only some - the new ones - of the tables in the database 
representing FKs on my models will have the database's constraints.

Does it even matter to have tables without those constraints? Django seemed to 
manage quite happily without them so far?

Many thanks for any suggestions,

Daniele


-- 
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 management commands

2011-10-28 Thread Daniele Procida
On Fri, Oct 28, 2011, Russell Keith-Magee  wrote:

>On Fri, Oct 28, 2011 at 12:49 AM, Leonardo Giordani
> wrote:
>> This is a problem related to Innodb and MyISAM. Django uses this
>> latter,
>
>Incorrect. Django doesn't have any built in preference for InnoDB or
>MyISAM -- it uses the system default table type. On most systems,
>MyISAM is the default, but this isn't guaranteed or expected.

COuld it still be the case that the issue is the result of the older Django 
database having used one engine by default, and the new one the other?

Daniele

-- 
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 management commands

2011-10-27 Thread Daniele Procida
On Thu, Oct 27, 2011, Tom Evans  wrote:

>On Thu, Oct 27, 2011 at 12:33 PM, Daniele Procida  wrote:

>> I keep getting errors like this:
>>
>> _mysql_exceptions.OperationalError: (1005, "Can't create table
>'arkestra_medic_dev.#sql-51b_4a8' (errno: 150)")
>>
>> when running database management commands (syncdb, south migrate).

>errno 150 indicates that you tried to create an innodb table with an
>incorrectly formed foreign key constraint.
>
>http://dev.mysql.com/doc/refman/5.0/en/innodb-error-codes.html
>
>Are you trying to reference a myisam table from an innodb table,

Not to my knowledge - certainly not deliberately!

> or
>are does the type of the column you are specifying as a foreign key
>not match the type of the primary key of the table you are
>referencing?

That's possible. I can understand how the complicated migration history might 
cause this though, but not a simple syncdb of easy_thumbnails!

Daniele

-- 
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 management commands

2011-10-27 Thread Daniele Procida
I keep getting errors like this:

_mysql_exceptions.OperationalError: (1005, "Can't create table 
'arkestra_medic_dev.#sql-51b_4a8' (errno: 150)")

when running database management commands (syncdb, south migrate).

Sometimes those commands work, sometimes they don't; it happens across a 
variety of apps.

I am working on a database that was exported from one system and has been 
imported into a new one.

Running Django 1.3.1. I'm pretty sure the issue is something to do with my 
database/setup, rather than anything in the apps involved.

Any suggestions greatly appreciated.

Daniele


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



Info and warning messages in admin

2011-06-27 Thread Daniele Procida
I need to be able to distinguish between info and warning messages that get 
passed to the user in admin.

I do this, and it works:

# import the admin messages framework
from django.contrib import admin, messages

class SomeForm(forms.ModelForm):
...
def clean(self):
# create a pair of empty lists for warning and information messages
SomeForm.warnings = []
SomeForm.info = []
... # do some things that add messages to the lists, based on
# things in cleaned_data
return self.cleaned_data

class SomeAdmin(admin.ModelAdmin):
...
def save_model(self, request, obj, form, change):
# loop over the lists of messages, and pass them to the messages system
for message in self.form.warnings:
messages.warning(request, message)
for message in self.form.info:
messages.info(request, message)
return super(SomeAdmin, self).save_model(request, obj, form, change)

This way yellow info messges get a little tick icon, while warnings have a 
warning sign (and really, ought to come up in orange, not yellow).

Is this a good or correct way of doing it?

Thanks for any advice or suggestions.

Daniele


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



DjangoCon.eu tickets

2011-04-23 Thread Daniele Procida
Tickets are sold out - to my horror, because I've bought my tickets for
travel, having finally persuaded my employer to let me attend.

They must have sold out shortly after I bought my travel tickets,
because they were available when I bought them.

I've applied to be on the waiting list, but if anyone finds themselves
with a surplus ticket...

Daniele

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



The correct way to send messages

2011-02-08 Thread Daniele Procida
In the clean() of an admin form I want to give the user some warnings.
So this is what I do in the admin -

class SomeForm(forms.ModelForm):
class Meta:
model = SomeModel

def clean(self):
self.warnings = []

self.warnings.append("Warning: you seem to be confused.")

return self.cleaned_data


class SomeModelAdmin(admin.ModelAdmin):
form = SomeForm

def response_change(self, request, obj):
for warning in SomeForm.warnings:
messages.warning(request, warning)

return super(SomeModelAdmin, self).response_change(request, obj)

Is that the correct way to do it? It works, but is that how it is
supposed to be done?

Thanks,

Daniele

-- 
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: Unrelated Inline admin objects

2009-11-01 Thread Daniele Procida

On Sun, Nov 1, 2009, Karen Tracey  wrote:

>> But what if there were no relation? How does the admin know which inline
>> items belong to it?
>>
>>
>You can't list an unrelated model inline with another.  I believe you'll get
>an error about no ForeignKey pointing to the parent model existing in the
>one you are trying to inline.

Thanks. 

I was then going to ask: suppose you have two ForeignKeys pointing to
the parent model? But I've just found the fk_name option for inlines,
which controls it.

Daniele


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



Unrelated Inline admin objects

2009-11-01 Thread Daniele Procida

Every example discussing inline admin objects invovles (naturally)
models that are related to one another, for example, a books model
placed inline on an authors model admin:



But what if there were no relation? How does the admin know which inline
items belong to it? 

Daniele


--~--~-~--~~~---~--~~
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 update a ManyToManyField in a model's custom save method

2009-09-24 Thread Daniele Procida

On Wed, Sep 23, 2009, M Godshall  wrote:

>
>I have a Project model with a ManyToManyField called "members" to keep
>track of members of a project.  Whenever the model is updated, I need
>to check if certain members need to be removed from or added to the
>m2m field. 

I am trying to do exactly the same thing as you (see the concurrent
thread "verriding save() for ManyToManyFields").

I am not having much luck.

So far I have ascertained that m2m fields *don't* need otb esaved to be
updated, but, like you:

> The most logical place to do this is in the model's custom
>save method, but when I try to save the model in the admin the members
>field reverts to its previous state even after running
>self.members.remove(user1) and self.members.add(user2).

It appears that they have changed, but the changes don't seem to get to
the database.

> From what I
>have researched and tested so far, if you save a project from a front-
>end view, the m2m field updates without reverting to its previous
>state, but I really need this functionality when a model is saved in
>the admin as well.

I have not seen anything to suggest that an admin save won't trigger
this, but whether I use a post_save signal, or try to do it in the save
() override, it fails to stick.

I really can't work out why it's failing to stick.

Daniele


--~--~-~--~~~---~--~~
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: overriding save() for ManyToManyFields

2009-09-24 Thread Daniele Procida

On Thu, Sep 24, 2009, Daniele Procida  wrote:

>>So, given a obj = Referrer("foo"), updating its many-to-many field can
>>happen only after obj.save() returns (this is documented in
>>http://www.djangoproject.com/documentation/models/many_to_many/ ).
>>
>>If you are not able to call obj.save() and then manually update the
>>fields, 
>
>Thanks - I have saved the object, with super(Event, self).save() in the
>save() function, and then updated the fields.
>
>However: I still need to save those changed fields to the database. If I
>call self.save, I end up recursing indefinitely. If I call super(Event,
>self).save() again, it appears to save nothing.

I understand now that it is not necessary to save changes to m2m fields
- they are saved as soon as they are made, which makes everything much
simpler.

So my save() method for the Event model is now:

def save(self):
# do some stuff for the other fields
super(Event, self).save()
if not self.enquiries.all():
self.enquiries = set()
for person in self.parent.enquiries.all():
self.enquiries.add(person)

Now if I print self.enquiries.all() and self.parent.enquiries.all(),
they appear to be the same. But, a test with:

if self.parent.enquiries.all() == self.enquiries.all():

suggest they are not.

At any rate, if they have been changed, the changes don't make it to the
database.

I'm clearly missing some important thing, but I can't work out what it is.

Daniele


--~--~-~--~~~---~--~~
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: overriding save() for ManyToManyFields

2009-09-24 Thread Daniele Procida

On Thu, Sep 24, 2009, mrts  wrote:

>So, given a obj = Referrer("foo"), updating its many-to-many field can
>happen only after obj.save() returns (this is documented in
>http://www.djangoproject.com/documentation/models/many_to_many/ ).
>
>If you are not able to call obj.save() and then manually update the
>fields, 

Thanks - I have saved the object, with super(Event, self).save() in the
save() function, and then updated the fields.

However: I still need to save those changed fields to the database. If I
call self.save, I end up recursing indefinitely. If I call super(Event,
self).save() again, it appears to save nothing.

So: having set the variables, how do I save them to the database? The
documentation at  doesn't mention how to do this - just how to make changes
to the object,

My function as it now stands is at , if that helps

Daniele




--~--~-~--~~~---~--~~
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: overriding save() for ManyToManyFields

2009-09-23 Thread Daniele Procida

On Wed, Sep 23, 2009, mrts  wrote:

>> So, obviously I need another stage, to save the many-to-many relations
>> once theo bject is saved.
>
>Call super(Event, self).save(), then update the many-to-many
>relations.

Don't I need to run some sort of save for those? Otherwise, what happens
to the attributes once I have set them?

Daniele


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



overriding save() for ManyToManyFields

2009-09-23 Thread Daniele Procida

My model has a save() override, in which a number of attributes (which
are ManyToManyFields) need to get their values from the object's parent:

def save(self):
if self.parent:
attribute_list = ['publishing_destinations',
'registration_enquiries', 'speakers', 'related_people', 'related_pages',
'related_events', 'related_newsarticles',]
for attribute in attribute_list:
if not getattr(self, attribute).all():
setattr(self, attribute, getattr(self.parent,
attribute).all())
super(Event, self).save()

These attributes don't survive the save() though (because they contain
many-to-many relations, the object needs to be saved to the database
before such relations to it can exist).

So, obviously I need another stage, to save the many-to-many relations
once theo bject is saved. 

What is the best way to achieve that?

Thanks,

Daniele


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

2009-08-01 Thread Daniele Procida

On Sat, Aug 1, 2009, Ramiro Morales  wrote:

>If you need this for the admin app and are using Django 1.1 read about
>the formfield_for_foreignkey ModelAdmin method:
>
>http://docs.djangoproject.com/en/dev/ref/contrib/admin/
>#django.contrib.admin.ModelAdmin.formfield_for_foreignkey
>
>you can write your own and further filter the queryset used for
>the FK field UI there, an example is included in the documentation

Thanks, I hadn't seen formfield_for_foreignkey before.

Part of that example goes does this:

Car.objects.filter(owner=request.user)

using the User instance as the basis for filtering. How could I refer to
the current instance of the model, to use that for filtering? 

In my case the model is Person, and field I want to get the choices from
is Entities.people (its related_name). So it owuld be something like:

Entities.objects.filter(people=[this instance of Person])

Daniele


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



limit_choices_to

2009-08-01 Thread Daniele Procida

I am trying to set up a model. 

A Person has a ManyToMany relationship with Entities. One of those
relationships is special - we can capture that with a ForeignKey
relationship to Entity.

But, I want to limit the choices for that special relationship to
Entities that the person already has a relationship with, by using a:

   limit_choices_to  = {field: value},


So, I have tried various things that look like this:

class Person(models.Model):
entities = models.ManyToManyField(
Entity, 
related_name = 'people', 
through ='Membership',
)
home_entity = models.ForeignKey(
Entity, 
related_name = 'people_home', 
limit_choices_to  = {'people': person},
)

but I can't get the limit_choices_to dictionary right (obviously, it's
not going to be literally {'people': person}).

What should I be doing here?

Thanks,

Daniele


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



Making Django ldapauth more sophisticated

2009-07-20 Thread Daniele Procida

I finally have ldapauth working now, and a user who is in our LDAP
database can connect as a Django User.

But it's not entirely satisfactory. Before the LDAP user becomes a
Django User they have to try logging (which fails of course). Then they
become a Django User, and then they can have their privileges set so
that they can log in.

That's all a bit messy - can it be improved, somehow?

A second question. I have a class called Person; every Person is also a User.

What I would like, when creating a new Person, is to be able to attach
the Person to a user from the LDAP database (based on their LDAP
canonical name).

Our LDAP database has many thousands of people in it, by the way.

(Later I might need to deal with Persons who are Users who aren't in the
LDAP database, but that can be dealt with another time.)

Any suggestions on how to proceed there?

Thanks,

Daniele


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

2009-07-18 Thread Daniele Procida

Some time ago, I successfully managed to get Django LDAP authentication
working. I used the patch at:



Now for the life of me I can't repeat my success.

Perhaps someone can remind me how I should expect this to work.

If I have set up LDAP correctly, and I try to log in with a username and
password that the LDAP server should recognise but aren't in Django's
Users, what should I expect to see?

Thanks,

Daniele



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