How to make generic variables available in settings and contexts?

2015-01-18 Thread ThomasTheDjangoFan
Ladies and gentleman, I am new to Django and would really love to have a solution for this: My goal is to share generated settings between my views/models and templates, without repeating myself. Right now I have following code, where the problem appears: #MY_CONTEXT_PROCESSOR.PY from django.c

Re: How to make generic variables available in settings and contexts?

2015-01-18 Thread James Schneider
If I understand you right, you want to set MAIN_CATEGORY as a "global" variable/setting containing a Category object with an ID of 1. Is that right? If so... Rather than populating a "global" variable, I would instead create a custom model manager for the Category model: https://docs.djangoprojec

Question for Django Core Team?

2015-01-18 Thread Petar Pilipovic
Hello there this is maybea of topic but I wont to ask Django Core Team, did they now someone who is practising Django in Belgrade-Serbia, or Zagreb-Croatia, I now there is a strong Slovenia team there, but I was wondering about this area around Bosnia where I live in. I am asking because I was i

Re: How to make generic variables available in settings and contexts?

2015-01-18 Thread ThomasTheDjangoFan
Hi James, thanks a lot for pointing me to the models.Mangager option. Now this is really interesting. I will definetly check out how caching works. Now the question is: How do I now access the CategoryManager.get_main_category() in my template.html? I guess I have to pass it over to context wit

Re: How to make generic variables available in settings and contexts?

2015-01-18 Thread James Schneider
If you need it in all of (or a large majority of) your templates, stick with the context processor you originally posted, just replace the Category.objects.get() call with the custom manager call. Your templates would then have access to {{ MAIN_CATEGORY }}. And with a context processor, that liter

Linking to multiple dynamic images from same web page

2015-01-18 Thread Derek
I have a situation which is puzzling. I have a web page that, when generated embeds links that look like: http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF1Wu3OfN9rmUKTDO%2BT%3DJan%3DF%3DLKODqQObds-tvME%3DUhL

Re: Linking to multiple dynamic images from same web page

2015-01-18 Thread Mitesh Patel
Hi Derek, I face same issue few months ago, what I did is I destroyed plot object completely everytime the view is called and regenerated new plot everytime. You can try that. There is an issue with matplotlib memory, which basically usage same plot. Another solution could be try different cStrin

How to add my Templates folder to TEMPLATE_DIRS

2015-01-18 Thread Kishan Mehta
Hello all, > I want to customise how admin page looks > I have my template folder in my application folder at C:\Users\kishan\Django_App\polls\templates\admin > In settings.py I have added TEMPLATE_DIRS = [os.path.join(BASE_DIR,'C:\Users\kishan\Django_App\polls\templates')] . > Changes I hav

Help a newb with authentication and registration

2015-01-18 Thread Nelson Varela
Hi, I don't know what allauth does but you can check the django docs about custom auth and user model: https://docs.djangoproject.com/en/1.7/topics/auth/customizing/ Maybe not what you are looking for but it's a good documentation whichs can help you understand more about this topic. -- You

Re: Django Admin UI Bug - 1.7.3

2015-01-18 Thread Timothy W. Cook
On Sat, Jan 17, 2015 at 11:49 AM, Collin Anderson wrote: > Hi, > > Did you also switch to Python 3? > ​Yes. Well, I didn't switch. I have been using Python 3 for quite some time. Even before it was officially supported. ​ > It doesn't seem to be using your __unicode__ method at all. > If you

Re: Django Admin UI Bug - 1.7.3

2015-01-18 Thread Collin Anderson
Hi, Rename your __unicode__ to __str__. Python 3 doesn't know what "__unicode__" is. :) You say this works fine: >>> from ccdgen.models import DvBoolean,DvAny, Common, Project >>> pcts = DvBoolean.objects.all() >>> for p in pcts: ... print(p.prj_name.prj_name) But django is expecting this als

Internal server error

2015-01-18 Thread Nicky Setia
Hi, I am following the Django tutorial and after I put my site up using Dreamworks hosting, it is giving me internal server error. Has anyone encountered this before? Any help would be appreciated! Thanks, Nicky -- You received this message because you are subscribed to the Google Groups "Dja

Re: Django Admin UI Bug - 1.7.3

2015-01-18 Thread Timothy W. Cook
On Sun, Jan 18, 2015 at 5:35 PM, Collin Anderson wrote: > Hi, > > Rename your __unicode__ to __str__. Python 3 doesn't know what > "__unicode__" is. :) > > ​Yep, that did it.​ Interesting that it was working up until now and that my AJAX calls worked either way. > You say this works fine: >

Re: Internal server error

2015-01-18 Thread Edgar Gabaldi
Nicky, Internal server error means that your application has a programming error. You can see your webserver log to find the error to fix. On Sun, Jan 18, 2015 at 5:43 PM, Nicky Setia wrote: > Hi, > I am following the Django tutorial and after I put my site up using > Dreamworks hosting, it is g

Queryset .count() breaks when counting distinct values generated by .extra()

2015-01-18 Thread Mattias Linnap
Hi all, I think I've found a strange case where QuerySet.count() does not match len(queryset), and the behaviour is certainly unexpected. But I'm not sure whether this is a bug, some mistake on my part, or a known limitation of combining .extra(), .distinct() and .count(). I am aware of the defa

Windows path for django_crontab

2015-01-18 Thread sarfaraz ahmed
Hello All, I am trying to use django_crontab to run repetitive task. I want to insert records to database on a particular time. Also, I am in process of learning django hence I m trying to reach every aspect of django. The issue i am facing i m able to configure django_crontab but its not able

Re: Windows path for django_crontab

2015-01-18 Thread Mike Dewhirst
On 19/01/2015 8:54 AM, sarfaraz ahmed wrote: Hello All, I am trying to use django_crontab to run repetitive task. I want to insert records to database on a particular time. Also, I am in process of learning django hence I m trying to reach every aspect of django. The issue i am facing i m able

Re: How to add my Templates folder to TEMPLATE_DIRS

2015-01-18 Thread Mike Dewhirst
On 18/01/2015 5:01 PM, Kishan Mehta wrote: Hello all, > I want to customise how admin page looks > I have my template folder in my application folder at C:\Users\kishan\Django_App\polls\templates\admin > In settings.py I have added TEMPLATE_DIRS = [os.path.join(BASE_DIR,'C:\Users\kishan\Dja

Re: Windows path for django_crontab

2015-01-18 Thread Edgar Gabaldi
To do periodic tasks you can use celery[1]. I believe that on windows works fine. [1] http://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html On Sun, Jan 18, 2015 at 9:24 PM, Mike Dewhirst wrote: > On 19/01/2015 8:54 AM, sarfaraz ahmed wrote: > >> Hello All, >> >> I am trying to u

Re: Canvas OAuth2 From Django View

2015-01-18 Thread Henry Versemann
Collin, thanks for the help. My django application as it is already has the "requests" library installed within it and I have already registered it with the API which I'm trying to authenticate to currently using that API's oauth2 web application flow, which is a three step process (see the oaut

Re: Canvas OAuth2 From Django View

2015-01-18 Thread Henry Versemann
Sergiy, Yes it is. Thanks. Henry On Saturday, January 17, 2015 at 10:36:06 AM UTC-6, Sergiy Khohlov wrote: > > Is CRFS protection enabled ? > 15 січ. 2015 18:51, користувач "Henry Versemann" > написав: > >> First let me say that I haven't done a lot of stuff with either Python or >> Django, but

Re: Instructions from Django to run under Python don't work.

2015-01-18 Thread Russell Keith-Magee
On Sun, Jan 18, 2015 at 10:23 AM, Lisa Jennings wrote: > I have been trying for two days to install django with Python 3.4 > operating in windows 7. Everything I try according to your instructions, > fails. The command "import django" seems to work but the command "print > (django.get_version())

Re: Question for Django Core Team?

2015-01-18 Thread Russell Keith-Magee
On Sun, Jan 18, 2015 at 8:28 PM, Petar Pilipovic wrote: > Hello there this is maybea of topic but I wont to ask Django Core Team, > did they now someone who is practising Django in Belgrade-Serbia, or > Zagreb-Croatia, I now there is a strong Slovenia team there, but I was > wondering about this

Re: Instructions from Django to run under Python don't work.

2015-01-18 Thread Lisa Jennings
I keep getting syntax errors. On Saturday, January 17, 2015 at 9:23:25 PM UTC-5, Lisa Jennings wrote: > > I have been trying for two days to install django with Python 3.4 > operating in windows 7. Everything I try according to your instructions, > fails. The command "import django" seems to wo

Re: Instructions from Django to run under Python don't work.

2015-01-18 Thread Some Developer
On 19/01/15 00:41, Lisa Jennings wrote: I keep getting syntax errors. What syntax errors? Be specific. -- 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

Unicode character in Django project path

2015-01-18 Thread Cheng Guo
Hello everyone, I am new to this community. I have run into an issue related to Unicode character in project path: http://stackoverflow.com/questions/27996774/unicode-character-in-django-project-path Another user on StackOverflow provided a detailed analysis of what is causing the bug in the l

Re: Unicode character in Django project path

2015-01-18 Thread James Schneider
After a quick search, this bug looks similar, but it's for an ancient version of Django. Might still give you some hints as to where to look. https://code.djangoproject.com/ticket/8965 If you can replicate the bug with an empty project and your template paths set, I would recommend filing a bug,

Re: Windows path for django_crontab

2015-01-18 Thread sarfaraz ahmed
Thanks for replies I really wish people who posted packages should mention clearly about which OS it;s going to work. I ended up wasting two workdays in experimenting with kronos,DJANGO-CHRONOGRAPH , DJANGO-CRONJOBS

Re: Instructions from Django to run under Python don't work.

2015-01-18 Thread Vinayak Kaniyarakkal
On Sunday, 18 January 2015 07:53:25 UTC+5:30, Lisa Jennings wrote: > > I have been trying for two days to install django with Python 3.4 > operating in windows 7. Everything I try according to your instructions, > fails. > > The command "import django" seems to work > That means django is

Re: Unicode character in Django project path

2015-01-18 Thread Cheng Guo
Thank you James. I will create an empty project and see if the error stil exists. On Monday, 19 January 2015 11:21:25 UTC+8, James Schneider wrote: > > After a quick search, this bug looks similar, but it's for an ancient > version of Django. Might still give you some hints as to where to look.

Newbie question: How to avoid a very long view function?

2015-01-18 Thread Cheng Guo
Hello, I am new to Django and I have run into an issue with views.py. I understand that there is a function behind each view. For a view that I am currently writing, it accepts a file upload from user and stores the file on the server. To do that, I need to: 1. check the file extension is cor

Re: Newbie question: How to avoid a very long view function?

2015-01-18 Thread Mike Dewhirst
On 19/01/2015 6:28 PM, Cheng Guo wrote: Hello, I am new to Django and I have run into an issue with views.py. I understand that there is a function behind each view. For a view that I am currently writing, it accepts a file upload from user and stores the file on the server. To do that, I need