Re: Expected performance of the django development server?

2015-01-04 Thread Jani Tiainen
On Sun, 4 Jan 2015 20:41:58 -0800 (PST)
Richard Brockie  wrote:

> Hello again,
> 
> I'm to the point in my django development that I am beginning to use 
> realistic amounts of test data. I'm using postgresql as the database 
> server, with PyCharm as my IDE, everything in a virtualenv on an SSD on an 
> Ivy Bridge Core i7 processor with 16 GB of RAM running Windows 7 64-bit. 
> 
> One disappointing thing I have just encountered is the lack of speed when 
> working with my real-world data. I'm comparing this with the same data in a 
> non-framework-based php/MySQL webapp running on XAMPP (which means apache) 
> in parallel on the same system.
> 
> With DjDT installed (Django development tools), I'm getting the following 
> stats:
> 
>- Quick to load page:SQL: 5 queries in 4 ms, Time: 76 ms
>- Slow to load page: SQL: 1189 queries in 463 ms, Time: 9754 ms
>
> From task manager, the slow to load page is making "python.exe *32" use 1 
> whole logical processor during the page load.
> 
> Are these expected response times? I'm hoping this is the result of a 
> non-optimized development server, and not the expected performance of 
> Django itself.
> 
> Any comments or advice?

By judging amount of queries of your "slow" page you probably have model(s) 
with foreign keys that you lazy load - which means that each fk is loaded 
individually from the database with separate query.

For example if you have a model that contains 4 foreign keys and you query 100 
instances (rows) you would actually invoke 1 + 4 * n queries, which in example 
case would be 401. 

Without actually knowning your code one of the first options you usually do to 
optimize queries is to use select_related and prefetch_related queryset methods 
to cut down number of queries needed.

-- 

Jani Tiainen

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


Re: Expected performance of the django development server?

2015-01-04 Thread Andrew Farrell
Another tool that is less robust but easier than django-debug-toolbar to
simply drop into your code is
import django.db.connection as conn
followed by putting
print(conn.queries)
or
print(len(conn.queries))
before and after where you suspect large numbers of repeated queries are
being executed.

(See also:
http://stackoverflow.com/questions/2133627/using-django-db-connection-queries
)

On Sunday, January 4, 2015, Andrew Farrell  wrote:

> To clarify: I'm not a django core dev and by "neglect" I don't mean that
> anyone is being neglectful, just focusing efforts elsewhere.
>
> On Sunday, January 4, 2015, Andrew Farrell  > wrote:
>
>> The django development server is slow by intentional neglect; It isn't
>> supposed to be used in production because the django team does not want to
>> divide its focus by supporting a full-fledged web server that is
>> performance-optimized and security-audited. They want to include a
>> development server that can be used by someone who wants to go from
>> 0-to-understanding-and-building with django without first having to install
>> a production server like gunicorn
>> .
>>
>> A few useful tools for improving your performance are select-related
>> 
>> , prefetch-related
>> ,
>> and Django-debug-toolbar
>> .
>> They can help you reduce the number of queries you are making.
>>
>> On Sun, Jan 4, 2015 at 10:41 PM, Richard Brockie <
>> richard.broc...@gmail.com> wrote:
>>
>>> Hello again,
>>>
>>> I'm to the point in my django development that I am beginning to use
>>> realistic amounts of test data. I'm using postgresql as the database
>>> server, with PyCharm as my IDE, everything in a virtualenv on an SSD on an
>>> Ivy Bridge Core i7 processor with 16 GB of RAM running Windows 7 64-bit.
>>>
>>> One disappointing thing I have just encountered is the lack of speed
>>> when working with my real-world data. I'm comparing this with the same data
>>> in a non-framework-based php/MySQL webapp running on XAMPP (which means
>>> apache) in parallel on the same system.
>>>
>>> With DjDT installed (Django development tools), I'm getting the
>>> following stats:
>>>
>>>- Quick to load page:SQL: 5 queries in 4 ms, Time: 76 ms
>>>- Slow to load page: SQL: 1189 queries in 463 ms, Time: 9754 ms
>>>
>>> From task manager, the slow to load page is making "python.exe *32" use
>>> 1 whole logical processor during the page load.
>>>
>>> Are these expected response times? I'm hoping this is the result of a
>>> non-optimized development server, and not the expected performance of
>>> Django itself.
>>>
>>> Any comments or advice?
>>>
>>> Thanks,
>>> R.
>>>
>>> --
>>> 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/9c8f3393-78b1-4d9f-a78d-954b957ebdfa%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/CA%2By5TLZYNA8T-L61N%2BHaC9wo5mJFu1kgKoobQ9VbWrGJyC%3DMow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Filter_horizontal, applying filter on the right box - chosen items

2015-01-04 Thread Aeh. ABID
I'm wondering if there is a standard way to add a javascript-based filter 
on the right box like the one in the  left
when having manytomany relation with filter_horizontal.

-- 
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/dfca942c-1b56-4b39-a92a-2322c0ccf26f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Expected performance of the django development server?

2015-01-04 Thread Andrew Farrell
To clarify: I'm not a django core dev and by "neglect" I don't mean that
anyone is being neglectful, just focusing efforts elsewhere.

On Sunday, January 4, 2015, Andrew Farrell  wrote:

> The django development server is slow by intentional neglect; It isn't
> supposed to be used in production because the django team does not want to
> divide its focus by supporting a full-fledged web server that is
> performance-optimized and security-audited. They want to include a
> development server that can be used by someone who wants to go from
> 0-to-understanding-and-building with django without first having to install
> a production server like gunicorn
> .
>
> A few useful tools for improving your performance are select-related
> 
> , prefetch-related
> ,
> and Django-debug-toolbar
> .
> They can help you reduce the number of queries you are making.
>
> On Sun, Jan 4, 2015 at 10:41 PM, Richard Brockie <
> richard.broc...@gmail.com
> > wrote:
>
>> Hello again,
>>
>> I'm to the point in my django development that I am beginning to use
>> realistic amounts of test data. I'm using postgresql as the database
>> server, with PyCharm as my IDE, everything in a virtualenv on an SSD on an
>> Ivy Bridge Core i7 processor with 16 GB of RAM running Windows 7 64-bit.
>>
>> One disappointing thing I have just encountered is the lack of speed when
>> working with my real-world data. I'm comparing this with the same data in a
>> non-framework-based php/MySQL webapp running on XAMPP (which means apache)
>> in parallel on the same system.
>>
>> With DjDT installed (Django development tools), I'm getting the following
>> stats:
>>
>>- Quick to load page:SQL: 5 queries in 4 ms, Time: 76 ms
>>- Slow to load page: SQL: 1189 queries in 463 ms, Time: 9754 ms
>>
>> From task manager, the slow to load page is making "python.exe *32" use 1
>> whole logical processor during the page load.
>>
>> Are these expected response times? I'm hoping this is the result of a
>> non-optimized development server, and not the expected performance of
>> Django itself.
>>
>> Any comments or advice?
>>
>> Thanks,
>> R.
>>
>> --
>> 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/9c8f3393-78b1-4d9f-a78d-954b957ebdfa%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/CA%2By5TLaLz_11SLBo9EN%2BR2YLxK_hGsXVAR5PALR9%2BE6LCjSP%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Expected performance of the django development server?

2015-01-04 Thread Andrew Farrell
The django development server is slow by intentional neglect; It isn't
supposed to be used in production because the django team does not want to
divide its focus by supporting a full-fledged web server that is
performance-optimized and security-audited. They want to include a
development server that can be used by someone who wants to go from
0-to-understanding-and-building with django without first having to install
a production server like gunicorn
.

A few useful tools for improving your performance are select-related

, prefetch-related
,
and Django-debug-toolbar
.
They can help you reduce the number of queries you are making.

On Sun, Jan 4, 2015 at 10:41 PM, Richard Brockie 
wrote:

> Hello again,
>
> I'm to the point in my django development that I am beginning to use
> realistic amounts of test data. I'm using postgresql as the database
> server, with PyCharm as my IDE, everything in a virtualenv on an SSD on an
> Ivy Bridge Core i7 processor with 16 GB of RAM running Windows 7 64-bit.
>
> One disappointing thing I have just encountered is the lack of speed when
> working with my real-world data. I'm comparing this with the same data in a
> non-framework-based php/MySQL webapp running on XAMPP (which means apache)
> in parallel on the same system.
>
> With DjDT installed (Django development tools), I'm getting the following
> stats:
>
>- Quick to load page:SQL: 5 queries in 4 ms, Time: 76 ms
>- Slow to load page: SQL: 1189 queries in 463 ms, Time: 9754 ms
>
> From task manager, the slow to load page is making "python.exe *32" use 1
> whole logical processor during the page load.
>
> Are these expected response times? I'm hoping this is the result of a
> non-optimized development server, and not the expected performance of
> Django itself.
>
> Any comments or advice?
>
> Thanks,
> R.
>
> --
> 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/9c8f3393-78b1-4d9f-a78d-954b957ebdfa%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/CA%2By5TLZkLiU-Yw4zD2gUJvVqo%2BZvQWiyMMs6oe4uJVczT6YZSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Expected performance of the django development server?

2015-01-04 Thread Richard Brockie
Hello again,

I'm to the point in my django development that I am beginning to use 
realistic amounts of test data. I'm using postgresql as the database 
server, with PyCharm as my IDE, everything in a virtualenv on an SSD on an 
Ivy Bridge Core i7 processor with 16 GB of RAM running Windows 7 64-bit. 

One disappointing thing I have just encountered is the lack of speed when 
working with my real-world data. I'm comparing this with the same data in a 
non-framework-based php/MySQL webapp running on XAMPP (which means apache) 
in parallel on the same system.

With DjDT installed (Django development tools), I'm getting the following 
stats:

   - Quick to load page:SQL: 5 queries in 4 ms, Time: 76 ms
   - Slow to load page: SQL: 1189 queries in 463 ms, Time: 9754 ms
   
>From task manager, the slow to load page is making "python.exe *32" use 1 
whole logical processor during the page load.

Are these expected response times? I'm hoping this is the result of a 
non-optimized development server, and not the expected performance of 
Django itself.

Any comments or advice?

Thanks,
R.

-- 
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/9c8f3393-78b1-4d9f-a78d-954b957ebdfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: modelformset question - interspersing extra forms among existing forms

2015-01-04 Thread Richard Brockie
Hi Collin,

Yes, you've answered my main question which was how to go about the 
implementation. I'll need to go through the details anyway, but you have 
given me a good start.

Thanks again,
R.

On Sunday, January 4, 2015 11:41:36 AM UTC-8, Collin Anderson wrote:
>
> Hi,
>
> If the field on the model is already blank=True, then you don't need that.
>
> Also, I realized my (completely untested :) code doesn't exactly match the 
> behavior you want, but I hope it's a good enough start. You may need to 
> store a reference to the original race_number to decide if you need to 
> .save() or not.
>
> Collin
>
> On Friday, January 2, 2015 9:42:47 PM UTC-5, Richard Brockie wrote:
>>
>> Hi Collin,
>>
>> Thanks very much for the advice. I'll be getting to this part of my 
>> development in the next few days and will report back when I have things 
>> working.
>>
>> One question in the meantime - what does this line do given that my model 
>> will already explicitly not require the race_number?
>>
>> race_number = Entry._meta.get_field('race_number').formfield(required=
>> False)
>>
>> Wishing everyone a prosperous New Year.
>> R.
>>
>>
>> On Thursday, January 1, 2015 3:31:45 PM UTC-8, Collin Anderson wrote:
>>>
>>> Hi,
>>>
>>> Your case is complicated enough that I'd actually recommend not using 
>>> formsets here and processing a list of plain ModelForms yourself in the 
>>> view. I bet formsets will ending out getting in your way.
>>>
>>> Here's a some messy code:
>>>
>>> class EntryForm(forms.ModelForm):
>>> race_number = Entry._meta.get_field('race_number').formfield(
>>> required=False)
>>> class Meta:
>>> model = Entry
>>> fields = ['race_number']
>>>
>>> def the_view(request, athlete_id):
>>> athlete = get_object_or_404(Athlete, id=athlete_id)
>>> existing = {e.category_id: e for e in athlete.entry_set.all()}
>>> entries = []
>>> for category in Category.objects.order_by('particular'):
>>> entries.append(existing.get(category.pk, Entry(athlete=athlete, 
>>> category=category)))
>>> if request.method = 'POST':
>>> forms = [EntryForm(request.POST, instance=e, prefix=e.category.
>>> pk) for e in entries]
>>> if all([f.is_valid() for f in forms]):  # be sure to call 
>>> is_valid() on every form
>>> for entry in entries:
>>> if entry.race_number:
>>> entry.save()
>>> if entry.pk and not entry.race_number:
>>> entry.delete()
>>> else:
>>> forms = [EntryForm(instance=e, prefix=e.category.pk) for e in 
>>> entries]
>>> return render(request, 'template.html', {'athlete': athlete, 'forms'
>>> : forms})
>>>
>>> {% for form in forms %}
>>> Category: {{ form.instance.category }}
>>> {{ form }}
>>> {% endfor %}
>>>
>>> Collin
>>>
>>> On Monday, December 29, 2014 6:07:19 PM UTC-5, Richard Brockie wrote:

 Hi,

 I have the following pseudo model that I will use as the basis of a 
 modelformset:

 class Entry:
 athlete = ForeignKey(athlete)
 category = ForeignKey(category)
 race_number = IntegerField

 I have a page that displays each athlete's details so the choice of 
 athlete has already been made. I want to add a formset that allows a user 
 to specify a race_number for each of the possible categories available.

 An obvious way would be for there to be one Entry for each 
 athlete/category, but in practise this will result in a large entry table 
 that is only ~10% actual data, with the rest being superfluous rows. I'd 
 prefer to avoid this.

 Let's assume that an athlete is already entered in 2 categories out of 
 a possible 10. The queryset will return the 2 existing entries, and I can 
 use extra=8 to add in the other possibilities. However, I am not yet done. 
 I want to do the following and would like advice on how to accomplish this:

1. The category for each the 8 possible new entries needs to be 
assigned before displaying the form - I already know what they are and 
 want 
to display these categories to the user, leaving the race_number as the 
only input field.
2. The categories have a particular (chronological) order that I 
want respected in displaying the forms to the user, so the 2 existing 
 and 8 
possible new categories need to be interspersed to follow the correct 
 order.
3. When it comes time to save the formset, I want only those 
categories that have been changed by having a race_number assigned or 
removed to be saved. I want the entries where the race_number has been 
removed to remain in the entry table. I think I need a way to detect 
 and 
remove the forms that have not been changed by the user before saving 
 the 
formset.

 Any pointers as to how to do this?

 Thanks!
 R.

Re: How to deplou 2 different django website in nginx?

2015-01-04 Thread Vijay Khemlani
as far as i know about nginx, server names are not separated by commas,
just spaces.

On Sun, Jan 4, 2015 at 3:51 PM, Fellipe Henrique  wrote:

> Hi there!
>
> I`m trying to make my nginx server work with 2 domains, with 2 different
> django websites.
>
> So, I have  a big, big problem here, because, when I type my domain2,
> appears my domain1... here is my 2 conf files I make to try to make 2
> domains works.
>
> Can anyone tell me, what I'm doing wrong here? I have a big, big problem,
> because my domain2 (my second django website)  will works with various
> sub-domains... I'm not getting create a domain, how can I create various
> subdomains? :)
>
> Best regards,
>
> [1] - http://pastebin.com/vu58wcu7
> [2] - http://pastebin.com/bGwerd4A
>
>
> T.·.F.·.A.·. S+F
> *Fellipe Henrique P. Soares*
>
> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
> 's/(.)/chr(ord($1)-2*3)/ge'
> *Blog: http://fhbash.wordpress.com/ *
> *GitHub: https://github.com/fellipeh *
> *Twitter: @fh_bash*
>
> --
> 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/CAF1jwZEnwS0pR4myRcG396FWSNGT90EhL80dBM1R2m06RNhE1Q%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/CALn3ei04WC2uG%2Bc-nRkxgFbOfSNDAs4034rU0SRCBFygk8DoVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Apache and Djagno

2015-01-04 Thread Collin Anderson
Hi,

What happens when you try?

"sudo a2ensite " expects a file here: 
/etc/apache2/sites-available/.conf

You then need to "sudo service apache2 reload"

Collin

On Saturday, January 3, 2015 11:45:00 AM UTC-5, SungHo Park wrote:
>
> Hi
> I have tried to use Django in Apache, but it doesn't work.
>
> My Django's version is 1.7.1 so I refered this page. 
> https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/  
> 
>
> I'm Korean and not good at English. But I tried to read whole of the 
> documents in that page, but it doesn't work.
> I searched it in Korean language and found out that it needs to enter 
> 'sudo a2ensite ', but it doesn't work, too.
>
> I applied 
>
> WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.pyWSGIPythonPath 
> /path/to/mysite.com
> Require all 
> granted
>
> this. 
> I use Ubuntu 14.04.
>
>
>
>
>
>
>
>
>
> dsf
>

-- 
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/08be9308-71c8-4a69-b53a-985c49adba1a%40googlegroups.com.
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: Change keys in values dictionary.

2015-01-04 Thread Collin Anderson
Hi,

Why not query it directly from Message?

Message.objects.filter(recipient__user__system_id=user_id).values('id', 
'subject')

Collin

On Friday, January 2, 2015 8:35:42 PM UTC-5, Lee Hinde wrote:
>
> If I do a query:
>
> messages = 
> Recipient.objects.filter(user__system_id=user_id).values("message__id","message__subject")
>
> and then
>
> {"data":list(messages)}
>
> jsonify it, I end up with:
>
>   "data" : [
> {
>   "message__id" : "2f24d132-4321-4d63-868a-21de6fbc0d44",
>   "message__subject" : "And look, a new subject."
> }
>   ],
>
> Let's assume there are lots of messages.
>
> What's the best way rename the keys? I.e, I'd like "message__id" to be 
> "id".
>
>
>

-- 
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/4d75e1df-0a33-4762-864c-ec1d0e4af7fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: modelformset question - interspersing extra forms among existing forms

2015-01-04 Thread Collin Anderson
Hi,

If the field on the model is already blank=True, then you don't need that.

Also, I realized my (completely untested :) code doesn't exactly match the 
behavior you want, but I hope it's a good enough start. You may need to 
store a reference to the original race_number to decide if you need to 
.save() or not.

Collin

On Friday, January 2, 2015 9:42:47 PM UTC-5, Richard Brockie wrote:
>
> Hi Collin,
>
> Thanks very much for the advice. I'll be getting to this part of my 
> development in the next few days and will report back when I have things 
> working.
>
> One question in the meantime - what does this line do given that my model 
> will already explicitly not require the race_number?
>
> race_number = Entry._meta.get_field('race_number').formfield(required=
> False)
>
> Wishing everyone a prosperous New Year.
> R.
>
>
> On Thursday, January 1, 2015 3:31:45 PM UTC-8, Collin Anderson wrote:
>>
>> Hi,
>>
>> Your case is complicated enough that I'd actually recommend not using 
>> formsets here and processing a list of plain ModelForms yourself in the 
>> view. I bet formsets will ending out getting in your way.
>>
>> Here's a some messy code:
>>
>> class EntryForm(forms.ModelForm):
>> race_number = Entry._meta.get_field('race_number').formfield(required
>> =False)
>> class Meta:
>> model = Entry
>> fields = ['race_number']
>>
>> def the_view(request, athlete_id):
>> athlete = get_object_or_404(Athlete, id=athlete_id)
>> existing = {e.category_id: e for e in athlete.entry_set.all()}
>> entries = []
>> for category in Category.objects.order_by('particular'):
>> entries.append(existing.get(category.pk, Entry(athlete=athlete, 
>> category=category)))
>> if request.method = 'POST':
>> forms = [EntryForm(request.POST, instance=e, prefix=e.category.pk
>> ) for e in entries]
>> if all([f.is_valid() for f in forms]):  # be sure to call 
>> is_valid() on every form
>> for entry in entries:
>> if entry.race_number:
>> entry.save()
>> if entry.pk and not entry.race_number:
>> entry.delete()
>> else:
>> forms = [EntryForm(instance=e, prefix=e.category.pk) for e in 
>> entries]
>> return render(request, 'template.html', {'athlete': athlete, 'forms': 
>> forms})
>>
>> {% for form in forms %}
>> Category: {{ form.instance.category }}
>> {{ form }}
>> {% endfor %}
>>
>> Collin
>>
>> On Monday, December 29, 2014 6:07:19 PM UTC-5, Richard Brockie wrote:
>>>
>>> Hi,
>>>
>>> I have the following pseudo model that I will use as the basis of a 
>>> modelformset:
>>>
>>> class Entry:
>>> athlete = ForeignKey(athlete)
>>> category = ForeignKey(category)
>>> race_number = IntegerField
>>>
>>> I have a page that displays each athlete's details so the choice of 
>>> athlete has already been made. I want to add a formset that allows a user 
>>> to specify a race_number for each of the possible categories available.
>>>
>>> An obvious way would be for there to be one Entry for each 
>>> athlete/category, but in practise this will result in a large entry table 
>>> that is only ~10% actual data, with the rest being superfluous rows. I'd 
>>> prefer to avoid this.
>>>
>>> Let's assume that an athlete is already entered in 2 categories out of a 
>>> possible 10. The queryset will return the 2 existing entries, and I can use 
>>> extra=8 to add in the other possibilities. However, I am not yet done. I 
>>> want to do the following and would like advice on how to accomplish this:
>>>
>>>1. The category for each the 8 possible new entries needs to be 
>>>assigned before displaying the form - I already know what they are and 
>>> want 
>>>to display these categories to the user, leaving the race_number as the 
>>>only input field.
>>>2. The categories have a particular (chronological) order that I 
>>>want respected in displaying the forms to the user, so the 2 existing 
>>> and 8 
>>>possible new categories need to be interspersed to follow the correct 
>>> order.
>>>3. When it comes time to save the formset, I want only those 
>>>categories that have been changed by having a race_number assigned or 
>>>removed to be saved. I want the entries where the race_number has been 
>>>removed to remain in the entry table. I think I need a way to detect and 
>>>remove the forms that have not been changed by the user before saving 
>>> the 
>>>formset.
>>>
>>> Any pointers as to how to do this?
>>>
>>> Thanks!
>>> R.
>>>
>>

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

Re: Problem migration to server with gunicorn and nginx

2015-01-04 Thread Collin Anderson
Hi,

Does doing a full start/stop of gunicorn fix it?

This could be an issue with PYTHONPATH (aka sys.path) and imports.

What's the output of sys.path?

What's your rough file tree? Why the double waitlist directories? Which 
directories have __init__.py files?

How are you referencing "waitlist" in INSTALLED_APPS?

Collin

On Friday, January 2, 2015 2:29:19 PM UTC-5, pythonista wrote:
>
> The application is working as expected in my development region, but when 
> the admin migrates it to the server and starts up gnicorn and nginx, I get 
> the following errror.
>
> I would appreciate any assistance.
>
> The application was running the first time we migrated 2 weeks ago to QA.
>
> Not sure if the admin changed anything on the server side during the past 
> 2 weeks.
>
> Thanks in advance.
>
>
>
> [2015-01-02 13:07:09 +] [20222] [DEBUG] GET /waitlist/
>
> [2015-01-02 13:07:09 +] [20222] [ERROR] Error handling request
>
> Traceback (most recent call last):
>
>   File 
> "/opt/python-2.7.8/lib/python2.7/site-packages/gunicorn-19.1.1-py2.7.egg/gunicorn/workers/sync.py",
>  
> line 93, in h  andle
>
> self.handle_request(listener, req, client, addr)
>
>   File 
> "/opt/python-2.7.8/lib/python2.7/site-packages/gunicorn-19.1.1-py2.7.egg/gunicorn/workers/sync.py",
>  
> line 134, in   handle_request
>
> respiter = self.wsgi(environ, resp.start_response)
>
>   File 
> "/opt/python-2.7.8/lib/python2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/handlers/wsgi.py",
>  
> line 187, in   __call__
>
> response = self.get_response(request)
>
>   File 
> "/opt/python-2.7.8/lib/python2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/handlers/base.py",
>  
> line 199, in   get_response
>
> response = self.handle_uncaught_exception(request, resolver, 
> sys.exc_info())
>
>   File 
> "/opt/python-2.7.8/lib/python2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/handlers/base.py",
>  
> line 239, in   handle_uncaught_exception
>
> if resolver.urlconf_module is None:
>
>   File 
> "/opt/python-2.7.8/lib/python2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/urlresolvers.py",
>  
> line 366, in   urlconf_module
>
> self._urlconf_module = import_module(self.urlconf_name)
>
>   File "/opt/python-2.7.8/lib/python2.7/importlib/__init__.py", line 37, 
> in import_module
>
> __import__(name)
>
>   File "/opt/housing/housing/housing/urls.py", line 9, in 
>
> url(r'^waitlist/', include('waitlist.urls')),
>
>   File 
> "/opt/python-2.7.8/lib/python2.7/site-packages/Django-1.7.1-py2.7.egg/django/conf/urls/__init__.py",
>  
> line 28, in   include
>
> urlconf_module = import_module(urlconf_module)
>
>   File "/opt/python-2.7.8/lib/python2.7/importlib/__init__.py", line 37, 
> in import_module
>
> __import__(name)
>
>   File "/opt/housing/housing/waitlist/urls.py", line 2, in 
>
> from waitlist import views
>
>   File "/opt/housing/housing/waitlist/waitlist/views.py", line 5, in 
> 
>
> from models import *
>
>   File "/opt/housing/housing/waitlist/waitlist/models.py", line 7, in 
> 
>
> class Post(models.Model):
>
>   File 
> "/opt/python-2.7.8/lib/python2.7/site-packages/Django-1.7.1-py2.7.egg/django/db/models/base.py",
>  
> line 285, in __n  ew__
>
> new_class._meta.apps.register_model(new_class._meta.app_label, 
> new_class)
>
>   File 
> "/opt/python-2.7.8/lib/python2.7/site-packages/Django-1.7.1-py2.7.egg/django/apps/registry.py",
>  
> line 213, in regi  ster_model
>
> (model_name, app_label, app_models[model_name], model))
>
> RuntimeError: Conflicting 'post' models in application 'waitlist':  'waitlist.waitlist.models.Post'> and  aitlist.waitlist.models.Post'>.
>
> [2015-01-02 14:07:21 +] [20214] [DEBUG] 3 workers
>
> [2015-01-02 14:07:36 +] [20214] [DEBUG] 3 workers
>
> [midware@itd-qa-wt-lap2 logs]$
>

-- 
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/5dfb3dbf-a5de-4c33-bcac-da96156cafcf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: create unmanaged model to oracle view/synonym

2015-01-04 Thread Collin Anderson
Hi,

What happens when you try Shai's suggestion?

class MyUnManagedModel(models.Model):
# ...
# fields
# ...
class Meta:
managed = False
db_table = 'view_name'

Collin

On Friday, January 2, 2015 9:05:24 AM UTC-5, Fabio Caritas Barrionuevo da 
Luz wrote:
>
> Hello, Shai and Edgar
>
> yes, I've tried using *inspectdb*, however, it only generates models for 
> database tables, but not for database View[1] and database Synonym[2].
>
> The Django documentation is currently not explicit in showing that the 
> specific database features are supported by Django database backends.
>
> *inspectdb *does not support "database schemas"[3][4].
>
> Any other ideas how to solve this?
>
>
> [1] 
> http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_8004.htm
> [2] 
> http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_8004.htm
> [3] https://groups.google.com/d/msg/django-users/jsoDvI7DipU/CYOdstKeTYcJ 
> [4] https://code.djangoproject.com/ticket/22673
>
>
> -- 
> Fábio C. Barrionuevo da Luz
> Acadêmico de Sistemas de Informação na Faculdade Católica do Tocantins - 
> FACTO
> Palmas - Tocantins - Brasil - América do Sul
>
> http://pythonclub.com.br/
>
>
> Em quinta-feira, 1 de janeiro de 2015 16h57min38s UTC-3, Edgar Gabaldi 
> escreveu:
>>
>> Fabio,
>>
>> Django ORM support Oracle Database[1].
>>
>> If you want connect an existing oracle database, i recomend you see the 
>> inspectdb management command.
>>
>> [1] https://docs.djangoproject.com/en/1.7/ref/databases/#oracle-notes
>> [2] https://docs.djangoproject.com/en/1.7/howto/legacy-databases/
>>
>>
>> On Thu, Jan 1, 2015 at 2:40 PM, Shai  wrote:
>>
>>> Hi Fábio,
>>>
>>> On Wednesday, December 31, 2014 6:05:05 PM UTC+2, Fabio Caritas 
>>> Barrionuevo da Luz wrote:

 Hello, is possible with Django 1.7 create a unmanaged Django model for 
 Oracle database View?



>>> Yes. In your model's Meta, set managed to False and db_table to the view 
>>> name:
>>>
>>> class MyUnManagedModel(models.Model):
>>> # ...
>>> # fields
>>> # ...
>>> class Meta:
>>> managed = False
>>> db_table = 'view_name'
>>>
>>> Have you run into difficulties?
>>>
>>> HTH,
>>> Shai.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/bf043f16-043a-4f0f-a6bf-2856c405be43%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/cf495f80-a7b1-4205-962d-5d3b46432446%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't save input to database

2015-01-04 Thread Collin Anderson
Hi,

You shouldn't have to use the {% url %} syntax. What does it end up 
generating if you view the source of the page? Is it /home/?

What was the error?

Collin

On Friday, January 2, 2015 9:04:22 AM UTC-5, Ronis wrote:
>
> Sorry I didn't the snippets are only available for 24 hours or little 
> more. They should extend that. 
>
> So finally I got it right! Uffa! 
>
>
> So basically I did one little change to the html code actually, and it 
> worked. 
>
> Here was the code:
>
> 
>   
> 
> 
>   Vem aí a 99 FITNESS
>   Em breve o maior aplicativo de fitness do Brasil
>   
>  enctype="plain">{% csrf_token %} 
>class="subscribe-input" placeholder="Coloque seu e-mail..." required>
>   Quero 
> ser avisado e virar vip!
> 
>
> I changed the action="/signup/" to action="{% url 'home'%}" and it start 
> saving the input to database. 
>
> Now my question is... because it wasn't a django code it wasn't working or 
> because I was passing the wrong html page? Because actually signup is the 
> page right after the form action, after the user submits the input. Do I 
> always have to specify the actions form forms in django code like that? 
>
> I tried using "/home/" instead and gave me an error. 
>
>
> Anyway I'm happy finally this simple thing is done! Thanks for the help btw
>
>
> On Tuesday, December 30, 2014 8:43:41 PM UTC-2, Vijay Khemlani wrote:
>>
>> the code sample links are broken :(
>>
>> On Tue, Dec 30, 2014 at 4:59 PM, Thomas Lockhart  
>> wrote:
>>
>>>  On 12/30/14 11:42 AM, Ronis wrote:
>>>  
>>> Hi guys, I can't save the input from a custom form to database. I don't 
>>> know what I am missing. 
>>>  
>>> I'm not sure either. But the html form you posted looks a *lot* like any 
>>> template you might find in a django deployment. If it were me I'd look 
>>> harder at just tying that in to the "usual places" and be done with it. 
>>> That will give you form validation etc nearly for free and save the next 
>>> person who is looking at your code from having to figure out what you did. 
>>> Patterns and idioms save a lot of thinking best used elsewhere...
>>>
>>> hth
>>>
>>> - Tom
>>>
>>>
>>>  
>>>  Because it's using a downloaded template from the web, I'm not using 
>>> the django forms. Instead, I'm trying to simply save the input from the 
>>> html form to the database. Im using the standard database when you create a 
>>> django project. When I checked the admin the inputs are not saved. 
>>>
>>>  Here is my code: 
>>>
>>>  
>>>  Views.py -> https://dpaste.de/SCBi
>>>
>>>  Models.py -> https://dpaste.de/3NX3
>>>
>>>  Admin.py -> https://dpaste.de/OWLS
>>>
>>>  htmlform -> https://dpaste.de/11DP
>>>
>>>  I'm a newbie programmer btw, this may be simple solution but I've 
>>> spent some time and couldn't figure it out =/ 
>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/ca13d351-0075-4000-902d-3f8755cb775e%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/54A3043E.10401%40gmail.com 
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/4c0bc923-424c-466c-9f95-fce9687d9b88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice about composing several templates

2015-01-04 Thread Andreas Kuhne
Hi Martin,

You are doing it correctly if you use the

{% include "foo/bar.html" %}

method.

I usually try to make my include templates as small as possible and use one
or more on a page to try to be as DRY as possible. It tends to make better,
smaller code and also it's easier when something changes.

Remember that you can also send information to the includes:

{% include "name_snippet.html" with person="Jane" greeting="Hello" %}

This also means that you can have a user page that displays everything
about a user, and send the user as a parameter to the include.

Regards,

Andréas

2015-01-04 19:41 GMT+01:00 Martin Torre Castro :

> Hello,
>
> I'm developing a web application with Django and we have met a dilemma
> about the design.
>
> We were making one template for every screen, but right now we have
> detected that some parts of of the screen with the information are repeated
> all over the different screens. For example, when coming to show personal
> data of a person, you can show also another data concerning that person,
> but not personal data (financial data, for instance).
>
> My intuition told me that we should look for a solution in which we could
> make small templates that we could compose, combine and concatenate and
> that we should also make different views or functions which would return
> its own associated template each one.
>
> Thus, *person_data()* would return the rendered template showing the
> name, surname, address, etc... and *financial_data()* would return the
> rendered template showing the salary, bank account, etc... After that, the
> desirable thing would be concatenating both or inserting them in a wider
> template for showing all this together.
>
> 
> ...
> {# Some html code here #}
> ...
> {# *person_data template* #}
> ...
> ...
> {# *financial_data template* #}
> ...
> {# Some html code here #}
> ...
> 
>
> So as always I made some research on the net and I found:
>
>
> https://docs.djangoproject.com/en/dev/ref/templates/builtins/#include
>
> a link which describes how to use include for inserting a template file in
> another template:
>
> {% include "foo/bar.html" %}
>
>
> And you can also use a variable from the python function with the path name 
> or an object with render method:
>
> {% include template_name %}
>
> So we could use all this in this way for combining, concatenating, composing 
> and operating on templates. We could choose the one which includes the others 
> and passing it the context for all templates (I suppose, I didn't test 
> anything). But I don't know if I'm well directed or if this is the best way 
> to go. I would appreciate some advice.
>
>
> I also found another interesting thread in stackoverflow talking about this:
>
> http://stackoverflow.com/questions/10985950/how-do-you-insert-a-template-into-another-template
>
> My idea is to have small templates which are used repeatedly in different 
> spots of the web and composing them in Unix-like style, so I would have small 
> visual pieces that would be used once and again saving a lot of hours of 
> writing of code.
>
>
> Please some advice.
>
> Thanks in advance
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To 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/440ce641-83aa-4cba-b2a9-566cdbc59344%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/CALXYUbmCCYw8HY%3D44hLgim%2BWmxENdrLk-H-Y%3DphDzFzXeFHviA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to deplou 2 different django website in nginx?

2015-01-04 Thread Fellipe Henrique
Hi there!

I`m trying to make my nginx server work with 2 domains, with 2 different
django websites.

So, I have  a big, big problem here, because, when I type my domain2,
appears my domain1... here is my 2 conf files I make to try to make 2
domains works.

Can anyone tell me, what I'm doing wrong here? I have a big, big problem,
because my domain2 (my second django website)  will works with various
sub-domains... I'm not getting create a domain, how can I create various
subdomains? :)

Best regards,

[1] - http://pastebin.com/vu58wcu7
[2] - http://pastebin.com/bGwerd4A


T.·.F.·.A.·. S+F
*Fellipe Henrique P. Soares*

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
*Blog: http://fhbash.wordpress.com/ *
*GitHub: https://github.com/fellipeh *
*Twitter: @fh_bash*

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


Advice about composing several templates

2015-01-04 Thread Martin Torre Castro
Hello,

I'm developing a web application with Django and we have met a dilemma 
about the design.

We were making one template for every screen, but right now we have 
detected that some parts of of the screen with the information are repeated 
all over the different screens. For example, when coming to show personal 
data of a person, you can show also another data concerning that person, 
but not personal data (financial data, for instance).

My intuition told me that we should look for a solution in which we could 
make small templates that we could compose, combine and concatenate and 
that we should also make different views or functions which would return 
its own associated template each one. 

Thus, *person_data()* would return the rendered template showing the name, 
surname, address, etc... and *financial_data()* would return the rendered 
template showing the salary, bank account, etc... After that, the desirable 
thing would be concatenating both or inserting them in a wider template for 
showing all this together.


...
{# Some html code here #}
...
{# *person_data template* #}
...
...
{# *financial_data template* #}
...
{# Some html code here #}
...


So as always I made some research on the net and I found:


https://docs.djangoproject.com/en/dev/ref/templates/builtins/#include

a link which describes how to use include for inserting a template file in 
another template:

{% include "foo/bar.html" %}


And you can also use a variable from the python function with the path name or 
an object with render method:

{% include template_name %}

So we could use all this in this way for combining, concatenating, composing 
and operating on templates. We could choose the one which includes the others 
and passing it the context for all templates (I suppose, I didn't test 
anything). But I don't know if I'm well directed or if this is the best way to 
go. I would appreciate some advice.


I also found another interesting thread in stackoverflow talking about this:

http://stackoverflow.com/questions/10985950/how-do-you-insert-a-template-into-another-template

My idea is to have small templates which are used repeatedly in different spots 
of the web and composing them in Unix-like style, so I would have small visual 
pieces that would be used once and again saving a lot of hours of writing of 
code.


Please some advice.

Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To 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/440ce641-83aa-4cba-b2a9-566cdbc59344%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django **not responding** when DEBUG = FALSE - No error raised / Apache HTTPError issue (?)

2015-01-04 Thread Paul Antropius
Okay, it was just an old and obsolete custom security with my wikitools 
module, that prevents the code to access an external website under debug 
mode...
It thus returned a 404 code, and the wikitools api was forcing the 
connection with this 5 seconds step pattern...

Let's rock ! :-)

BTW : I figured out when the bugs come from by running the debug django 
server on my production server. Quitting it after realizing it produced the 
same error dumped a very useful backtrack message...

-- 
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/78c2c4ff-a7b6-4582-90d9-b511524baf0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: dashboard for user profile

2015-01-04 Thread Fabio Caritas Barrionuevo da Luz


Em sexta-feira, 13 de julho de 2012 09h14min21s UTC-3, psychok7 escreveu:
>
> yes i understand that, but i am asking if there is a pluggable app that 
> does that for us with some jquery and stuff. 
>
> as i said theres is django-profiles, but i think its poorly documented and 
> i am not able to figure it out
>

see if any of those suits your need:

https://www.djangopackages.com/grids/g/profiles/

https://www.djangopackages.com/grids/g/profiles-2/  

-- 
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/2d99d256-a429-48ec-822a-88d550253775%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


is there a Django library for AJAX support

2015-01-04 Thread Krishnakant Mane

Hello all,
I am realy impressed with the Django forms and some additional 
enhancements with CrispyForms 

Specially that additional library does a great job with css management 
making it possible to make the forms look good and accessible using only 
Python code.

Is there some thing similar for AJAX support?
I wish some thing like this.
Make a form using Crispy forms or even simple Django forms.
If a submit is required for sending an AJAX request and getting response 
either in JSOn or otherwise, some Python code which exploites the 
functionality of Jquery or any JS library is available.
The entire AJAX code is written using Python, just like the way css is 
managed with the above mentioned library, so that one does not have to 
go back to the template and write the javascript code, then come back to 
the view to check the form for IDs of fields etc.
This moving back and forth for either css or javascript could be avoided 
(Crispy forms already does it for css as I said before ).

Kindly let me know if such a thing exists.
Happy hacking.
Krishnakant.

--
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/54A93CCE.6070108%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django **not responding** when DEBUG = FALSE - No error raised / Apache HTTPError issue (?)

2015-01-04 Thread Paul Antropius


Le dimanche 4 janvier 2015 00:16:33 UTC+1, Mike Dewhirst a écrit :
>
> On 3/01/2015 10:19 PM, Paul Antropius wrote: 
> > Good morning, 
> > 
> > The production server sends absolutely **no response** when DEBUG is set 
> > to FALSE. 
> > Browser still waits for a response : no error (neither 404, nor 500) is 
> > raised. Minutes later, it ends up with a 503 error. 
> > 
> > Apache error log reads : 
> > HTTPError: HTTP Error 404: Not Found trying request again in 5 seconds 
> > HTTPError: HTTP Error 404: Not Found trying request again in 10 seconds 
> > HTTPError: HTTP Error 404: Not Found trying request again in 15 seconds 
> > ... 
> > I can find not instance of this king of behaviour looking in Google : 
> > why would apache repeatingly try to connect after a HTTPError ? Is the 
> > server supposed to set himself up after realizing it has been wrong ?? 
> > 
> > I have looked after the common issues : 
> > 
> > 1) ALLOWED_HOST is set correctly. ['*'] leads to the same result. 
> > 
> > 2) It looks like there is no "ImportError" (I have grossly checked that 
> > the code is loaded, and I guess it would otherwise raise an 
> ImportError). 
>
> If the system works under the dev server it looks like all the software 
> works. But the dev server is quite forgiving if software loads in the 
> "wrong" sequence. Apache might be revealing import loops. 
>
> You could try moving imports out of the module and down into the method 
> namespaces experimentally to see if that helps.  
>
Yes, I'm afraid I will have to chat a few hours with my beloved server to 
get it right (it's for tomorrow morning... !).
However, I wonder : wouldn't an ImportError be raised in that case ?

>
> > 
> > 3) I do have static files issues : some are not loading as expected, 
> > using {% load staticfiles %} and {% static ''%}. 
> > I have suspected that my custom 404.html page would loop with a static 
> > file HTTPError, but it is apparently not the case. 
>
> Try vanilla 404 for the moment. 
>
> Huh ? Ok, i'll see what I can find :-) 

> > 
> > What I can affirm : 
> > The error occurs after : 
> > * settings.py is loaded. 
> > * models are loaded ; 
> > 
> > The error occurs before : 
> > * urls.conf is loaded ; 
> > * views.py is loaded. 
> > 
> > Eventually, I do not understand : 
> > * what raises a HTTPError when DEBUG is set to False ; 
> > * why this HTTPError is not caught by Django ; 
> > * Why apache does not simply sends back a 404 signal ? 
>
> Apache seems to be retrying the 404 every 5*n seconds where n is 
> incrementing by 1 for each retry. I think I would be trying to change 
> that behaviour first and maybe eliminate retries until the "main" 
> problem surfaces. 
>
> I'd like to, but... a Google search "Aapche trying request again in " gave 
me no clue ! Interestingly, my post is now the first Google reference under 
this key expression... 
I think I will have to find without this indication.

> > 
> > I'm stuck on a saturday trying to figure out where and what would be 
> > this error. 
>
> Sunday morning here :) 
>
> Mid in France. Thank you for your response :-) 

> > 
> > Any help would be very appreciated. 
> > 
> > Thank you very much. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to django-users...@googlegroups.com  
> > . 
> > To post to this group, send email to django...@googlegroups.com 
>  
> > . 
> > Visit this group at http://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/9f348c04-79e7-43e7-be51-31180d7658e0%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/9f348c04-79e7-43e7-be51-31180d7658e0%40googlegroups.com?utm_medium=email&utm_source=footer>.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>

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


Re: dashboard for user profile

2015-01-04 Thread Derek
Yes, I found some guidance on how to construct a dashboard page; but mine
is for creating summary of some of the key data, not so much for
user-related info (although I may still need to do this in future).

On 3 January 2015 at 14:00, Aaron Reabow  wrote:

> Did you ever find anything like this?
>
> On Friday, 13 July 2012 03:57:45 UTC+2, psychok7 wrote:
>>
>> i there,
>> i am trying to write a dashboard page to present after user login. i have
>> been searching google and only found *django-admin-tools . won*dering if
>> there is something like that for a user profile page (tried django-profiles
>> with no luck)
>>
>> thanks
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/yV7nvPuQNMQ/unsubscribe.
> To unsubscribe from this group and all its topics, 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/5c1ccc8d-e4f0-4e0a-b663-6903ec2c5c5b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/CAF1Wu3PXREGR7UFe2t0nqZCD5O3%3Dx7Ex9omQp51mYLrugqp45Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.