Admin doesn't show all entities

2014-09-18 Thread Dmitry Mikhaylov
I really don't know what might be wrong, but admin doesn't list some of my 
entities. There're two links in list header saying:

1736 results 2520 total

When I click on "2520 total", it just show the same list with 1736 results. I 
can open objects change-forms using their ids though.

A couple months ago I did some migrations for the schema, maybe I did something 
wrong. But if I did, I guess I couldn't access those objects at all...

Please, help me.

-- 
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/e6fe0fef-f9ab-4418-b7de-09c4b6a34aa6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Possible bug introduced in Django 1.7 admin/docs?

2014-09-18 Thread Christopher Welborn
On 09/18/2014 10:50 PM, James Bennett wrote:
> Are you using any third-party libraries which were installed as eggs?
> 

It looks like I have several...

Third-party extensions:
django-extensions 1.3.3
django-solo   1.0.5

Non-extensions, but dependencies of extensions:
sqlparse0.1.11 (django-debug-toolbar dependency)
user_agents 0.2.0 (local extension dependency)
ua_parser   0.3.5 (local extension dependency)

Non-extensions, but imported:
pyscopg2  2.5.2
pytidylib 0.2.3
twython   3.1.2

I am basing this on the fact that these all have [module-name].egg-info
in my /dist-packages/ dir. I have a couple others that have no .egg-info.

-- 
\¯\  /¯/\
 \ \/¯¯\/ / / Christopher Welborn (cj)
  \__/\__/ /  cjwelborn at live·com
   \__/\__/   http://welbornprod.com

-- 
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/lvga8q%24g1c%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.


Re: Possible bug introduced in Django 1.7 admin/docs?

2014-09-18 Thread James Bennett
Are you using any third-party libraries which were installed as eggs?

-- 
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/CAL13Cg_Fw34Oncp-YkDgt536LUF_JQf9%2Be%3D5UBdvMX%2BW8ixw1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Possible bug introduced in Django 1.7 admin/docs?

2014-09-18 Thread Christopher Welborn
On 09/18/2014 10:32 PM, I wrote:
>  Internal Server Error: /admin/doc/filters/

> "/home/cjwelborn/lib/python3.3/django/contrib/admindocs/views.py", line 
> 314, in load_all_installed_template_libraries
>  for p in os.listdir(os.path.dirname(upath(mod.__file__)))
>  AttributeError: 'module' object has no attribute '__file__'

It does it for admin/doc/tags also. Not /models, /views, or /bookmarklets.
-- 
\¯\  /¯/\
 \ \/¯¯\/ / / Christopher Welborn (cj)
  \__/\__/ /  cjwelborn at live·com
   \__/\__/   http://welbornprod.com

-- 
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/lvg92k%242vq%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.


Possible bug introduced in Django 1.7 admin/docs?

2014-09-18 Thread Christopher Welborn
I was just playing around after upgrading from 1.6.6, I made small 
changes to my source to make it compatible. It was using the old 
WSGIHandler() style for wsgi.py, so I switched to 
get_wsgi_application(). I upgraded django-debug-toolbar, because it was 
incompatible. Everything on my site works. The admin works. Some of the 
admin/doc stuff works. However, when visiting admin/doc/filters this 
happened:



Internal Server Error: /admin/doc/filters/
Traceback (most recent call last):
  File 
"/home/cjwelborn/lib/python3.3/django/core/handlers/base.py", line 111, 
in get_response
response = wrapped_callback(request, *callback_args, 
**callback_kwargs)
  File 
"/home/cjwelborn/lib/python3.3/django/views/generic/base.py", line 69, 
in view

return self.dispatch(request, *args, **kwargs)
  File "/home/cjwelborn/lib/python3.3/django/utils/decorators.py", 
line 29, in _wrapper

return bound_func(*args, **kwargs)
  File 
"/home/cjwelborn/lib/python3.3/django/contrib/auth/decorators.py", line 
22, in _wrapped_view

return view_func(request, *args, **kwargs)
  File "/home/cjwelborn/lib/python3.3/django/utils/decorators.py", 
line 25, in bound_func

return func.__get__(self, type(self))(*args2, **kwargs2)
  File 
"/home/cjwelborn/lib/python3.3/django/contrib/admindocs/views.py", line 
43, in dispatch

return super(BaseAdminDocsView, self).dispatch(*args, **kwargs)
  File 
"/home/cjwelborn/lib/python3.3/django/views/generic/base.py", line 87, 
in dispatch

return handler(request, *args, **kwargs)
  File 
"/home/cjwelborn/lib/python3.3/django/views/generic/base.py", line 154, 
in get

context = self.get_context_data(**kwargs)
  File 
"/home/cjwelborn/lib/python3.3/django/contrib/admindocs/views.py", line 
100, in get_context_data

load_all_installed_template_libraries()
  File 
"/home/cjwelborn/lib/python3.3/django/contrib/admindocs/views.py", line 
314, in load_all_installed_template_libraries

for p in os.listdir(os.path.dirname(upath(mod.__file__)))
AttributeError: 'module' object has no attribute '__file__'


It doesn't seem to touch any of my stuff, or any of the changes I 
mentioned previously. Only Django's stuff. Any ideas?


--
\¯\  /¯/\
 \ \/¯¯\/ / / Christopher Welborn (cj)
  \__/\__/ /  cjwelborn at live·com
   \__/\__/   http://welbornprod.com

--
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/lvg84v%24qqt%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.


django 1.7: inlines not deleted when save_formset is overridden

2014-09-18 Thread scott baker
I've modified an Admin with code similar to the following:

def save_formset(self, request, form, formset, change):
instances = formset.save(commit=False)
for instance in instances:
instance.user = request.user
instance.save()
formset.save_m2m()


The problem I'm having is that if a "delete" checkbox is checked, the 
inline does not get deleted. I tracked this down to 
forms/models.py:save_existing_objects(). In Django 1.5 it deleted objects 
regardless of the setting of the commit argument. In django 1.7, it does 
not delete the objects if commit==False. 

Am I missing something in the above that I need to do in order to cause my 
deleted inlines to be deleted? I can do it by looping through 
formset.deleted_forms myself (basically duplicating the code from 
save_existing_objects), but this feels like the wrong way to go about it. 

Thanks,
Scott

-- 
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/2e6b89cb-9850-428e-b718-9d4fe1db0c27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help me: Django 1.6.4 + mod_wsgi Error

2014-09-18 Thread Yj Lee
I have same issue on my local computer. please help me, 

2014년 7월 10일 목요일 오전 8시 18분 4초 UTC+9, Russell Keith-Magee 님의 말:
>
> Hi LongYuan,
>
> It's difficult to say for certain, but it looks to me like your Django 
> install is corrupted. The error you're seeing indicates that an import is 
> failing; if you've got a clean install of Django 1.6.4 like you say, that 
> import should work without any problems.
>
> Two things to try:
>
>  * Start up a Python shell manually, using the same version of Python as 
> Apache is using. See if the import fails there as well.
>
>  * Re-install Django. Make sure that you *completely* uninstall it first, 
> so there's no chance that stale files are lingering, and then reinstall.
>
> Yours,
> Russ Magee %-)
>
>
> On Wed, Jul 9, 2014 at 3:01 PM, LongYuan  
> wrote:
>
>> [Wed Jul 09 14:51:19 2014] [error]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\utils\\encoding.py", line 14, in 
>> 
>> [Wed Jul 09 14:51:19 2014] [error] from 
>> django.utils.six.moves.urllib.parse import quote
>> [Wed Jul 09 14:51:19 2014] [error] ImportError: cannot import name quote
>>
>>
>> The Apache2.2 service is restarting.
>> The Apache2.2 service has restarted.
>> arent: Received restart signal -- Restarting the server.
>> [Wed Jul 09 09:51:47 2014] [notice] Child 12544: Exit event signaled. 
>> Child process is ending.
>> [Wed Jul 09 09:51:47 2014] [warn] mod_wsgi: Compiled for Python/2.7.6.
>> [Wed Jul 09 09:51:47 2014] [warn] mod_wsgi: Runtime using Python/2.7.3.
>> [Wed Jul 09 09:51:47 2014] [notice] Apache/2.2.25 (Win32) mod_wsgi/3.5 
>> Python/2.7.3 configured -- resuming normal operations
>> [Wed Jul 09 09:51:47 2014] [notice] Server built: Jul 10 2013 01:52:12
>> [Wed Jul 09 09:51:47 2014] [notice] Parent: Created child process 7956
>> [Wed Jul 09 09:51:47 2014] [warn] mod_wsgi: Compiled for Python/2.7.6.
>> [Wed Jul 09 09:51:47 2014] [warn] mod_wsgi: Runtime using Python/2.7.3.
>> [Wed Jul 09 09:51:47 2014] [notice] Child 7956: Child process is running
>> [Wed Jul 09 09:51:48 2014] [notice] Child 12544: Released the start mutex
>> [Wed Jul 09 09:51:48 2014] [notice] Child 7956: Acquired the start mutex.
>> [Wed Jul 09 09:51:48 2014] [notice] Child 7956: Starting 64 worker 
>> threads.
>> [Wed Jul 09 09:51:48 2014] [notice] Child 7956: Starting thread to listen 
>> on port 80.
>> [Wed Jul 09 09:51:49 2014] [notice] Child 12544: All worker threads have 
>> exited.
>> [Wed Jul 09 09:51:49 2014] [notice] Child 12544: Child process is exiting
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] mod_wsgi 
>> (pid=7956): Target WSGI script 'F:/dj_spiders/dj_spiders/wsgi.py' cannot be 
>> loaded as Python module.
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] mod_wsgi 
>> (pid=7956): Exception occurred processing WSGI script 
>> 'F:/dj_spiders/dj_spiders/wsgi.py'.
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] Traceback (most 
>> recent call last):
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1]   File 
>> "F:/dj_spiders/dj_spiders/wsgi.py", line 13, in 
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] from 
>> django.core.wsgi import get_wsgi_application
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\core\\wsgi.py", line 1, in 
>> 
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] from 
>> django.core.handlers.wsgi import WSGIHandler
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line 
>> 9, in 
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] from django 
>> import http
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\http\\__init__.py", line 1, in 
>> 
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] from 
>> django.http.cookie import SimpleCookie, parse_cookie
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\http\\cookie.py", line 3, in 
>> 
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] from 
>> django.utils.encoding import force_str
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\utils\\encoding.py", line 11, in 
>> 
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] from 
>> django.utils.six.moves.urllib.parse import quote
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] ImportError: cannot 
>> import name quote
>>
>> -- 
>> 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 

Re: problem with a date between a form and database

2014-09-18 Thread swiesner
Timezones are hard.

Is USE_TZ=True in your settings?

I'd highly recommend starting on this 
page: https://docs.djangoproject.com/en/dev/topics/i18n/timezones/

Sid


On Thursday, September 18, 2014 9:59:55 AM UTC-4, gh224391 wrote:
>
> hello all, 
> i have a form to get a date. But when i get object from the database, 
> the database is not as expected, user type "18/09/2015", but after 
> savin, i got: 17/09/2015 22:00 
>
> here is the code: 
>
> #settings.py 
> TIME_ZONE = 'Europe/Paris' 
>
> #models.py 
> class MyEvent(models.Model): 
>  dtstart = models.DateTimeField(auto_now=False, auto_now_add=False) 
>
> # forms.py 
> class UpdateAnnounceForm(forms.ModelForm): 
>  dtstart = forms.DateField(widget=forms.DateInput(format = 
> '%d/%m/%Y'), 
>   input_formats=('%d/%m/%Y',)) 
>  class Meta: 
>  model = MyEvent 
>  def clean_dtstart(self): 
>  return datetime.combine(self.cleaned_data['dtstart'], 
> datetime.min.time()) 
>
>
> # views.py 
>  if form.is_valid(): 
>  logger.debug("form %s" % form.cleaned_data) 
>  form.save() 
> -> 
> DEBUG 2014-09-18 15:42:48,169 views.py create_event 216 form {'dtstart': 
> datetime.datetime(2015, 9, 18, 0, 0, tzinfo= CEST+2:00:00 DST>)} 
>
> # python manage.py shell 
> In [18]: evt=MyEvent.objects.get(id=39194) 
> In [19]: evt.dtstart 
> Out[19]: datetime.datetime(2015, 9, 17, 22, 0, tzinfo=) 
>
> thanks in advance for help, 
>
>
> -- 
> Gérard Henry 
>

-- 
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/3f3793e1-3f8d-4130-bf8a-63a5576a7bfd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: display the elements from a database in a forms

2014-09-18 Thread Jonathan Pentecost
Are you using Django models?

On Thursday, 18 September 2014 02:36:53 UTC+10, Devin Cky wrote:
>
>
> 2 months ago yes !! please i need your help .. it's very importante for 
> me !!!
>

-- 
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/8fac0bbb-d6f7-4e5d-bacb-57e1430eb53c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Turn off migrations completely in Django 1.7

2014-09-18 Thread Nikolas Stevenson-Molnar
You could always set your models to managed=False 
https://docs.djangoproject.com/en/dev/ref/models/options/#managed


_Nik

On 9/18/2014 2:04 PM, Anthony Tuininga wrote:

Hi,

I just upgraded my test environment to Django 1.7 and immediately 
noticed that mgirations appear to be a requirement. Searching the 
documentation and the code itself seems to indicate that there is no 
way to disable it, either. Did I miss something? I don't need or want 
Django to create or alter any database objects and up to Django 1.6 I 
could quite happily ignore syncdb but it seems I can't ignore 
migrations. Please advise! Thanks.


Anthony
--
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/9bdd258f-a21b-48a0-ab1b-b3a4123b40c1%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/541B6CA1.6040402%40consbio.org.
For more options, visit https://groups.google.com/d/optout.


Re: Turn off migrations completely in Django 1.7

2014-09-18 Thread m1chael
Hi,

I feel your pain, but I think you can utilize something with --fake

I have been using databases for many, many years, and honestly-
migrations definitely make sense. I am able to add new fields within a
few seconds without having to do any extra work. It takes 2 minutes to
learn how to use migrations, and I will personally never look back.

Mike



On Thu, Sep 18, 2014 at 5:04 PM, Anthony Tuininga
 wrote:
> Hi,
>
> I just upgraded my test environment to Django 1.7 and immediately noticed
> that mgirations appear to be a requirement. Searching the documentation and
> the code itself seems to indicate that there is no way to disable it,
> either. Did I miss something? I don't need or want Django to create or alter
> any database objects and up to Django 1.6 I could quite happily ignore
> syncdb but it seems I can't ignore migrations. Please advise! Thanks.
>
> Anthony
>
> --
> 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/9bdd258f-a21b-48a0-ab1b-b3a4123b40c1%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/CAAuoY6PU62d7BCvGXfFR%3D-KUBQ9tRcKVPvJ1mfdE189CTViD-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Turn off migrations completely in Django 1.7

2014-09-18 Thread Anthony Tuininga
Hi,

I just upgraded my test environment to Django 1.7 and immediately noticed 
that mgirations appear to be a requirement. Searching the documentation and 
the code itself seems to indicate that there is no way to disable it, 
either. Did I miss something? I don't need or want Django to create or 
alter any database objects and up to Django 1.6 I could quite happily 
ignore syncdb but it seems I can't ignore migrations. Please advise! Thanks.

Anthony

-- 
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/9bdd258f-a21b-48a0-ab1b-b3a4123b40c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


new to django data modeling for an application

2014-09-18 Thread dk
i did the django tutorial  and to get a better grasp i decided to make a 
webpage.  with 2 sections

section 1
every day will let the user vote for a restaurant before 4pm

section 2
from the restaurant with more votes will display the menu of the 
restaurant  and each user can chose what they want for dinner.
that way the admin of the restaurant can just print that list every day =)

and if some one ask me for information,  
i would like to be able to tell them, 
a date, what restaurant was choosen, how many votes, and the selection of 
the users.
maybe they want to know whats the most popular restaurant, or the food that 
more people select from a particular restaurant

(this was very easy in my head till i got to thing on the data base tables 
and how they should be connected)

so first things first.

i made my django project, 
added an application call poll

in here i should have my
restaurant table with a choise list of the restaurants that can be chosen.

and after that should be another table with the dishes. where the forgen 
key is the restaurant???
how i do this one?

thaks guys.












-- 
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/5c575766-191d-4c29-8811-9c033efc2127%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How/where to call setlocale

2014-09-18 Thread James Hargreaves
Hi Ulrich et al,

Thanks again for your help.

I'm having issues with your solution. It works when making a literal call
to locale but Django is not using the correct locale for some reason.

I added this to my application.wsgi:

import locale

locale.setlocale(locale.LC_ALL, 'en_GB.utf-8')

I added a context processor which outputs the following:

def common(request=None):
return {
'TODAY' : date.today(),
'LOCALE' : locale.getlocale(),
'LOCALE_DF' : locale.nl_langinfo(locale.D_FMT),
}

And I added the following to my template:

{{ LOCALE }}
{{ LOCALE_DF }}
{{ TODAY|date:"SHORT_DATE_FORMAT" }}

Which unexpectedly outputs this:

('en_GB', 'UTF-8')
%d/%m/%y
09/18/2014

I also tried adding the locale.setlocale(...) line to my settings.py
instead but that had no effect either.

Any ideas appreciated please.

Thanks
Jay

On 17 September 2014 07:38, James Hargreaves 
wrote:

> Thanks Ulrich.
>
> No I think I've misread the documentation with regards it affecting the
> whole environment rather than the program.
>
> I'll try your solution myself but it looks like it will work, thanks!
>
> Jay
>
>
> On Tuesday, September 16, 2014, uvetter 
> wrote:
>
>> Dear Jay,
>>
>> I just tried to following in my wsgi.py file:
>>
>>
>> import os
>> import sys
>> import site
>> import locale
>>
>> site.addsitedir('/mypath/lib/python3.3/site-packages')
>>
>> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")
>>
>> os.environ['HTTPS'] = "on"
>>
>> sys.path.append('/mypath/test')
>> sys.path.append('/mypath/test/test')
>> sys.path.append('/mypath/test/app1')
>> sys.path.append('/mypath/test/app2')
>>
>> activate_env=os.path.expanduser("/mypath/bin/activate_this.py")
>> exec(open(activate_env).read())
>>
>> locale.setlocale(locale.LC_ALL, 'en_US.utf-8')
>>
>> from django.core.wsgi import get_wsgi_application
>> application = get_wsgi_application()
>>
>>
>>
>> This sets the locale correctly for all calls to my Django application.
>>
>> I just realized that in your first post you mentioned that "this affects
>> the entire environment". I just read through the locale module
>> documentation, which states that "The C standard defines the locale as a
>> program-wide property ". This means that there will be no system-wide
>> changes when you call locale.setenv(). Or did I misunderstand you?
>>
>> Best wishes,
>> Ulrich
>>
>> Am Dienstag, 16. September 2014 22:39:08 UTC+2 schrieb James Hargreaves:
>>>
>>> Thanks for your reply Ulrich.
>>>
>>> If I set the locale in WSGI would that persist for all connections? If
>>> so that sounds like the best option.
>>>
>>> Thanks
>>> Jay
>>>
>>> On Tuesday, September 16, 2014,  wrote:
>>>
 Hi,
 I ran into a similar problem yesterday while programming a web shop
 with Django (Version 1.6, Python version 3.3) where language switching
 should immediately have an effect on the way prices, etc. are displayed
 (doing so by a  in the
 template and redirecting back to the page where it was called). The locale
 is indeed not set this way and needs to be set explicitly. What I finally
 came up with as a first working solution as part of a function:

 def convert_my_price(_price)  # _price is a decimal.Decimal
 language = django.utils.translation.get_language()
 if language == 'en':
 locale.setlocale(locale.LC_ALL, 'en_US.utf-8') #
 'en_GB.utf-8'  didn't work for me
 else:
 locale.setlocale(locale.LC_ALL, 'de_DE.utf-8')# this is
 the fallback

 _loc = locale.localeconv()
 .
 .  # process the Decimal
 .
 return my_price_as_a_string

 After doing so I have access to the locale details stored in the
 dictionairy _loc, like e.g. _loc['thousands_sep'], _loc['currency_symbol']
 in this function, but also everywhere else via locale.localeconv()
 This function however is currently called from within class based
 views, but also implemented as a template filter. Of course one should not
 set the locale every time when calling this function, as you mentioned
 locale.getlocale() will should whether it was correctly set or not.

 Where you call locale.setlocale depends on your application. When you
 only have to set it once maybe the best would be to call it in even in e.g.
 wsgi.py

 Best regards,
 Ulrich

  --
>>>
>>>
>>> --
>>> a: 1 Oak Cottage, Town Lane, Mobberley, WA16 7HJ
>>> t: 01565 873 019 | 07899 872 306
>>> e: ja...@hargreaves.me.uk
>>>
>>>  --
>> 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/9kuQBMknp9g/unsubscribe.
>> To unsubscribe from this group and all its 

Can I use a calculated value for a key to a dictionary?

2014-09-18 Thread Joel Goldstick
I have some embed loops which iterate over league and division.  I
want to print the teams in each.  I obviously can't do what i tried in
line 19.  Is there a way to calculate a key to a dictionary I want to
iterate over?

14{% for l in leagues %}
15 {{l}}
16 {% for d in divisions %}
17 {{d}}
18 
19 {% for team in {{l}}{{d}} %}
20 {{team}} {{ team.wins }}-{{ team.losses
}} 
21 {% endfor %}

Here is my context:

{u'ALW': [, , , ,
, ],
u'ALE': [, ,
, , , ], u'NLE': [, , , , , ], u'NLW': [, , , , , ]}
{'leagues': [u'AL', u'NL'], u'NLE': [,
, , , , ], u'NLW': [, , , , , ], 'year': u'1975', u'ALW': [,
, , , , ], u'ALE': [, , , , , ], 'divisions': [u'E', u'W']}

-- 
Joel Goldstick
http://joelgoldstick.com

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


Re: Customise admin view

2014-09-18 Thread Salvatore DI DIO
That's great
Thank you very very much Helton




Le jeudi 18 septembre 2014 15:44:44 UTC+2, Helton Alves a écrit :
>
> I think this will resolve your problem. :D
>
> in admin, you use the get_queryset.
> in this case return only items of user, you can change this for return the 
> items that user have permission.
>
> class MyModelAdmin(admin.ModelAdmin):
> def queryset(self, request):
> qs = super(MyModelAdmin, self).queryset(request)
> if request.user.is_superuser:
> return qs
> return qs.filter(author=request.user)
>
>
> 2014-09-18 14:17 GMT+01:00 Salvatore DI DIO  >:
>
>> Hy Elton,
>>
>> In fact each image belongs to an album.
>> Let us say I have three album ALB1 ALB2 ALB3
>>
>> In the admin form, when I add an image I can attach it to either of each 
>> Albums
>> or all the three if I want
>>
>> What I would like is show the album list for a particuliar user.
>>
>> For example Tom could only add images in ALB1
>>Henry could add images in ALB2 and ALB3
>>   
>>
>> I hope it's a little clearer
>>
>>
>>
>>
>>
>>
>>
>> Le jeudi 18 septembre 2014 14:05:13 UTC+2, Helton Alves a écrit :
>>>
>>> I didn't understand very well.
>>> would you like the image of the tutorial?
>>>
>>> 2014-09-18 9:59 GMT+01:00 Salvatore DI DIO :
>>>
 Hello,

 I am following a 'photo application' tutorial : 
 http://lightbird.net/dbe/photo.html
 I have created several 'albums' to insert images in.

 I would like those albums beeing displayed in the admin panel
 according to each user or group


 Thank your for your help

 regards



  -- 
 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/3ad874fd-9629-44e4-8cf4-0da6ac522492%
 40googlegroups.com 
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> -- 
>>>
>>> Helton Alves 
>>> Desenvolvedor web
>>> Graduado em Sistemas de Informação - FACIMP
>>> Cursando Metodologia do Ensino Superior - INESPO
>>>  
>>  -- 
>> 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/e28b8164-017e-4932-8afc-f62533b6b02d%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> Helton Alves 
> Desenvolvedor web
> Graduado em Sistemas de Informação - FACIMP
> Cursando Metodologia do Ensino Superior - INESPO
>  

-- 
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/6b84c3c8-9c0e-4f6e-8558-0793f55f11e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


unicode problems in admin interface

2014-09-18 Thread Jaap van Wingerde
I have suddenly unicode problems with de admin interface:

"DjangoUnicodeDecodeError at /admin/art/photographextra/

'ascii' codec can't decode byte 0xc3 in position 32: ordinal not in
range(128). You passed in  ()
...
Unicode error hint

The string that could not be encoded/decoded was: l>Mus��e du"

The site itself is behaving well:
.

settings.py:
"...
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'grappelli.dashboard',
'grappelli',
  # Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
'art',
'rosetta',
'dbgettext',
)
...
DEFAULT_CHARSET='utf-8'
FILE_CHARSET='utf-8'
DEFAULT_CONTENT_TYPE='text/html'
..."

"jaap@liakoster:/var/django/liakoster.nl/test2$ python -c "import
django; print(django.get_version())" 1.7
jaap@liakoster:/var/django/liakoster.nl/test2$ python -V
Python 2.7.3
jaap@liakoster:/var/django/liakoster.nl/test2$"



What is going on?


-- 

Jaap van Wingerde
e-mail: 1234567...@vanwingerde.nl



signature.asc
Description: PGP signature


problem with a date between a form and database

2014-09-18 Thread gerard

hello all,
i have a form to get a date. But when i get object from the database, 
the database is not as expected, user type "18/09/2015", but after 
savin, i got: 17/09/2015 22:00


here is the code:

#settings.py
TIME_ZONE = 'Europe/Paris'

#models.py
class MyEvent(models.Model):
dtstart = models.DateTimeField(auto_now=False, auto_now_add=False)

# forms.py
class UpdateAnnounceForm(forms.ModelForm):
dtstart = forms.DateField(widget=forms.DateInput(format = '%d/%m/%Y'),
 input_formats=('%d/%m/%Y',))
class Meta:
model = MyEvent
def clean_dtstart(self):
return datetime.combine(self.cleaned_data['dtstart'], 
datetime.min.time())



# views.py
if form.is_valid():
logger.debug("form %s" % form.cleaned_data)
form.save()
->
DEBUG 2014-09-18 15:42:48,169 views.py create_event 216 form {'dtstart': 
datetime.datetime(2015, 9, 18, 0, 0, tzinfo=CEST+2:00:00 DST>)}


# python manage.py shell
In [18]: evt=MyEvent.objects.get(id=39194)
In [19]: evt.dtstart
Out[19]: datetime.datetime(2015, 9, 17, 22, 0, tzinfo=)

thanks in advance for help,


--
Gérard Henry

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


Re: Customise admin view

2014-09-18 Thread Helton Alves
I think this will resolve your problem. :D

in admin, you use the get_queryset.
in this case return only items of user, you can change this for return the
items that user have permission.

class MyModelAdmin(admin.ModelAdmin):
def queryset(self, request):
qs = super(MyModelAdmin, self).queryset(request)
if request.user.is_superuser:
return qs
return qs.filter(author=request.user)


2014-09-18 14:17 GMT+01:00 Salvatore DI DIO :

> Hy Elton,
>
> In fact each image belongs to an album.
> Let us say I have three album ALB1 ALB2 ALB3
>
> In the admin form, when I add an image I can attach it to either of each
> Albums
> or all the three if I want
>
> What I would like is show the album list for a particuliar user.
>
> For example Tom could only add images in ALB1
>Henry could add images in ALB2 and ALB3
>   
>
> I hope it's a little clearer
>
>
>
>
>
>
>
> Le jeudi 18 septembre 2014 14:05:13 UTC+2, Helton Alves a écrit :
>>
>> I didn't understand very well.
>> would you like the image of the tutorial?
>>
>> 2014-09-18 9:59 GMT+01:00 Salvatore DI DIO :
>>
>>> Hello,
>>>
>>> I am following a 'photo application' tutorial :
>>> http://lightbird.net/dbe/photo.html
>>> I have created several 'albums' to insert images in.
>>>
>>> I would like those albums beeing displayed in the admin panel
>>> according to each user or group
>>>
>>>
>>> Thank your for your help
>>>
>>> regards
>>>
>>>
>>>
>>>  --
>>> 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/3ad874fd-9629-44e4-8cf4-0da6ac522492%
>>> 40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Helton Alves 
>> Desenvolvedor web
>> Graduado em Sistemas de Informação - FACIMP
>> Cursando Metodologia do Ensino Superior - INESPO
>>
>  --
> 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/e28b8164-017e-4932-8afc-f62533b6b02d%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Helton Alves 
Desenvolvedor web
Graduado em Sistemas de Informação - FACIMP
Cursando Metodologia do Ensino Superior - INESPO

-- 
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/CABcoSmBMpio4vswwtATSBZZb-u2Q%2BDdf_ku7d%2BLAep4W-b2AJg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.6 Nginx with static files outside project folder

2014-09-18 Thread Florian Auer
Hello.

It seems im stuck in the try to deploy my django project, consisting of 
multiple apps, to the production server at the point of serving the static 
files from the preferred directory.

system details:
- CentOS 6.5
- Django 1.6.4
- green Unicorn python server
- Nginx webserver
- python 3.3.5

pyvenv layout:
|-webapps
| |-sonar
| | |-bin
| | |-include
| | |-lib   #site-packages folder insite
| | |-logs  #server logfiles 
| | |-run   #sock files
| | |-static#collected static files
| | |-myproject
| | | |-[app folders]
| | | |-requirements.txt
| | | |-static  #central static location for development
| | | |-[...]
| | | |-myproject
| | | | |-settings.py
| | | | |-[...]

settings.py (shortend)
# -*- coding: utf-8 -*- 
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1']

TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
)

TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages'
)

STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

# Application definition

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
[...]
)

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

#START addition or userauth app
INSTALLED_APPS += (
'userauth',
)
LOGIN_URL = '/benutzer/anmelden/'
LOGOUT_URL = '/benutzer/abmelden/'
LOGIN_REDIRECT_URL = '/'
#END addition or userauth app

#START Mobile Detection -> based on mobileESP
MIDDLEWARE_CLASSES += (
'mobileesp.middleware.MobileDetectionMiddleware',
)
#END Mobile Detection
INSTALLED_APPS += (
'south',
)
#fix for mysqlConector: http://www.robberphex.com/2014/02/317
SOUTH_DATABASE_ADAPTERS = {
'default': 'south.db.mysql'
}
#END addition for south DB Migration Tool

#START addition for dajax (0.6)
INSTALLED_APPS += (
'dajaxice',
'dajax'
)
STATICFILES_FINDERS += (
'dajaxice.finders.DajaxiceFinder',
)
ROOT_URLCONF = 'myproject.urls'
WSGI_APPLICATION = 'myproject.wsgi.application'

DATABASES = {
'default': {
'ENGINE': 'mysql.connector.django',
'NAME': 'myproject',
'USER': 'root',
'PASSWORD': 'tekkoadmin',
'HOST': '127.0.0.1',
'PORT': '3306'
}
}
LANGUAGE_CODE = 'de'
TIME_ZONE = 'Europe/Berlin'
USE_I18N = True
USE_L10N = True
USE_TZ = True

# Static files (CSS, JavaScript, Images)
STATIC_ROOT = '/webapps/sonar3/static/' #production
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
#'/webapps/sonar3/static/', #not jet used
)

TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
os.path.join(BASE_DIR, 'templates/desktop'),
os.path.join(BASE_DIR, 'templates/tablet'),
os.path.join(BASE_DIR, 'templates/mobile'),
)

# define if services should use multithreading
SERVICES_USE_THREADS = False

nginx.conf
upstream sonar_app_server {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a
# single worker for timing out). 
server unix:/webapps/sonar3/run/gunicorn.sock fail_timeout=0;
}
 
server {
listen 8001;
server_name myproject.de;
 
client_max_body_size 4G;
 
access_log /webapps/sonar3/logs/nginx-access.log;
error_log /webapps/sonar3/logs/nginx-error.log;
location /static {
alias /webapps/sonar3/static;
}
location /media {
alias /webapps/sonar3/media;
}
 
location / {
# an HTTP header important enough to have its own Wikipedia 
entry:
# http://en.wikipedia.org/wiki/X-Forwarded-For
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 
# enable this if and only if you use HTTPS, this helps Rack
# set the proper protocol for doing redirects:
# proxy_set_header 

Re: Customise admin view

2014-09-18 Thread Salvatore DI DIO
Hy Elton,

In fact each image belongs to an album.
Let us say I have three album ALB1 ALB2 ALB3

In the admin form, when I add an image I can attach it to either of each 
Albums
or all the three if I want

What I would like is show the album list for a particuliar user.

For example Tom could only add images in ALB1
   Henry could add images in ALB2 and ALB3
  

I hope it's a little clearer







Le jeudi 18 septembre 2014 14:05:13 UTC+2, Helton Alves a écrit :
>
> I didn't understand very well.
> would you like the image of the tutorial?
>
> 2014-09-18 9:59 GMT+01:00 Salvatore DI DIO  >:
>
>> Hello,
>>
>> I am following a 'photo application' tutorial : 
>> http://lightbird.net/dbe/photo.html
>> I have created several 'albums' to insert images in.
>>
>> I would like those albums beeing displayed in the admin panel
>> according to each user or group
>>
>>
>> Thank your for your help
>>
>> regards
>>
>>
>>
>>  -- 
>> 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/3ad874fd-9629-44e4-8cf4-0da6ac522492%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> Helton Alves 
> Desenvolvedor web
> Graduado em Sistemas de Informação - FACIMP
> Cursando Metodologia do Ensino Superior - INESPO
>  

-- 
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/e28b8164-017e-4932-8afc-f62533b6b02d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Simple task. Get request.META values listed on a page via template

2014-09-18 Thread Sergiy Khohlov
simple ways is using form and passing values to the template from the form.
https://docs.djangoproject.com/en/dev/topics/forms/

Many thanks,

Serge


+380 636150445
skype: skhohlov

On Mon, Sep 8, 2014 at 7:08 PM, Артём Мутерко 
wrote:

> I need to list all values from request.META in Django using template.
>
> I've done it without template like this
> (code from my views.py)
>
> def display_meta(request):
>   values = request.META.items()
>   values.sort()
>   html = []
>   for k, v in values:
>   html.append(‘%s%s’ % (k, v))
>   return HttpResponse(‘%s’ % ‘\n’.join(html))
>
> For example I have template 'values.html', how can I do the same as above
> but using template and not hardcoding html in views.py?
>
>  --
> 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/4673f20b-aa76-4012-882b-fa370299ba1a%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/CADTRxJNOSFmZpW5CZi_S2CWtuftLF%2B%2BtkFzzaht98kLuTpj-Aw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Customise admin view

2014-09-18 Thread Helton Alves
I didn't understand very well.
would you like the image of the tutorial?

2014-09-18 9:59 GMT+01:00 Salvatore DI DIO :

> Hello,
>
> I am following a 'photo application' tutorial :
> http://lightbird.net/dbe/photo.html
> I have created several 'albums' to insert images in.
>
> I would like those albums beeing displayed in the admin panel
> according to each user or group
>
>
> Thank your for your help
>
> regards
>
>
>
>  --
> 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/3ad874fd-9629-44e4-8cf4-0da6ac522492%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Helton Alves 
Desenvolvedor web
Graduado em Sistemas de Informação - FACIMP
Cursando Metodologia do Ensino Superior - INESPO

-- 
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/CABcoSmBxd%2BLx9m9L3UK7wesjg%3DREPai%3D5csZxJ6dfSP1iZnQYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Customise admin view

2014-09-18 Thread Salvatore DI DIO
Hello,

I am following a 'photo application' tutorial : 
http://lightbird.net/dbe/photo.html
I have created several 'albums' to insert images in.

I would like those albums beeing displayed in the admin panel
according to each user or group


Thank your for your help

regards



-- 
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/3ad874fd-9629-44e4-8cf4-0da6ac522492%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


unbalanced parenthesis

2014-09-18 Thread James Schneider
You likely have a regular expression that is trying to match using groups,
and a '(' or ')' are missing or added as extras without a mate.

http://lmgtfy.com/?q=Python+unbalanced+parenthesis=1

-James

On Wednesday, September 17, 2014, ngangsia akumbo > wrote:

> i dont understand what is going on i need some help
> error at /admin/
>
> unbalanced parenthesis
>
> Request Method:GETRequest URL:http://localhost:8000/admin/Django Version:
> 1.4.3Exception Type:errorException Value:
>
> unbalanced parenthesis
>
> Exception Location:/usr/lib/python2.7/re.py in _compile, line 244Python
> Executable:/usr/bin/pythonPython Version:2.7.6Python Path:
>
> ['/home/yems/apps/project1',
>  '/usr/lib/python2.7/dist-packages',
>  '/usr/local/lib/python2.7/dist-packages/django_mptt-0.6.0-py2.7.egg',
>  '/usr/local/lib/python2.7/dist-packages/pytz-2014.7-py2.7.egg',
>  '/usr/lib/python2.7',
>  '/usr/lib/python2.7/plat-i386-linux-gnu',
>  '/usr/lib/python2.7/lib-tk',
>  '/usr/lib/python2.7/lib-old',
>  '/usr/lib/python2.7/lib-dynload',
>  '/usr/local/lib/python2.7/dist-packages',
>  '/usr/lib/python2.7/dist-packages/PILcompat',
>  '/usr/lib/python2.7/dist-packages/gst-0.10',
>  '/usr/lib/python2.7/dist-packages/gtk-2.0',
>  '/usr/lib/pymodules/python2.7',
>  '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
>  '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
>
> Server time:Wed, 17 Sep 2014 16:13:15 +0100
>
> --
> 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/88f2339c-1c46-4d14-b604-a0516cc95151%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%2Be%2BciW3uWDvJk9SHgUuZV-j9mPyrNFHDqzxd%2BKj4SB_OYOHHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.