Insert variable into RequestContext?

2013-05-03 Thread Mike Doroshenko II
Hi all, I want to make all the pages for my project state whether it's running on my live server or a backup server and am already using RequestContext for all my views that call my templates. I was thinking I would write some code that uses if statements against the hostname to add a variable

Building a HN/Reddit clone with Mezzanine/Django: Drum

2013-05-03 Thread Stephen McDonald
Hey all, If you're unfamiliar with Mezzanine, it's a CMS project built on Django - in fact the most downloaded CMS project for Django according to PyPi. I've wrote a lengthy post on how to use some of the non-CMS features of Mezzanine - Building a HN/Reddit clone with Mezzanine/Django: Drum http

Re: FW:

2013-05-03 Thread Kurtis Mullins
Phishing Web Site (SPAM) On Sat, Apr 6, 2013 at 9:10 PM, Ian Foote wrote: > http://kyokushin-aoki.sakura.ne.jp/www/tvojdi.php > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails fro

FW:

2013-05-03 Thread Ian Foote
http://kyokushin-aoki.sakura.ne.jp/www/tvojdi.php -- 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 grou

Re: arabic input

2013-05-03 Thread Randa Hisham
i changed the Collation of the model field to utf8_bin and it worked On Sat, May 4, 2013 at 12:35 AM, Randa Hisham wrote: > i need to save form > > > On Sat, May 4, 2013 at 12:31 AM, Javier Guerra Giraldez < > jav...@guerrag.com> wrote: > >> On Fri, May 3, 2013 at 5:27 PM, Randa Hisham >> wr

Multi-DB read replica unit test raises TransactionManagementError

2013-05-03 Thread TTimo
Hello, I started assessing multi-db support in Django 1.5.1, I'm interested in having read replicas and a write master. I've figured out all the easy stuff: using TEST_MIRROR in the DATABASES setting, writing a simple router that splits read and write traffic, all according to the documentatio

Re: arabic input

2013-05-03 Thread Randa Hisham
i need to save form On Sat, May 4, 2013 at 12:31 AM, Javier Guerra Giraldez wrote: > On Fri, May 3, 2013 at 5:27 PM, Randa Hisham > wrote: > > "\xD8\xB5\xD8\xB5\xD8\xB5" > > print "\xD8\xB5\xD8\xB5\xD8\xB5".decode('utf8') > ==> صصص > > > > -- > Javier > > -- > You received this message because

Re: arabic input

2013-05-03 Thread Javier Guerra Giraldez
On Fri, May 3, 2013 at 5:27 PM, Randa Hisham wrote: > "\xD8\xB5\xD8\xB5\xD8\xB5" print "\xD8\xB5\xD8\xB5\xD8\xB5".decode('utf8') ==> صصص -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop recei

arabic input

2013-05-03 Thread Randa Hisham
when write arabic input in django it turn into "\xD8\xB5\xD8\xB5\xD8\xB5" -- Randa Hesham Software Developer Twitter:@ro0oraa FaceBook:Randa Hisham ٍ -- You received this message because you are subscribed to the Google Grou

Re: Django - Query

2013-05-03 Thread Larry Martell
On Fri, May 3, 2013 at 3:22 PM, Hélio Miranda wrote: > I am trying a query in Django for mongodb, but I do not get it. > I'm doing this: > > Código (Python): > post = Solution.objects.get({'SolutionName':'MEGLES'}) > print post > > But it prints the following: Solution object > > What am I doing w

Django - Query

2013-05-03 Thread Hélio Miranda
I am trying a query in Django for mongodb, but I do not get it. I'm doing this: Código (Python): post = Solution.objects.get({'SolutionName':'MEGLES'}) print post But it prints the following: Solution object What am I doing wrong? Someone can help me? -- You received this message because you a

Re: Form constructor: Learn model instance for ModelChoiceField?

2013-05-03 Thread Carsten Fuchs
Hi Mike, Am 2013-05-03 15:40, schrieb MikeKJ: have you checked out forms.ModelForm? from django.forms import ModelForm Thanks for your reply, but this seems not to be related to the problem? At least I cannot see how this could help. Best regards, Carsten -- You received this message becau

Re: Problem with Django 1.5.1 and django-pyodbc

2013-05-03 Thread Vernon D. Cole
Kerry: This is not what you asked for, but it might work for both of us... I am working on an update for django-mssql for 1.5.1 and could really use a beta tester. To be specific, I am pulling the old, customized ado api module out and replacing it with the next version of adodbapi. (The *next*

Re: list comprehension query

2013-05-03 Thread MikeKJ
Thanks Tom good points as well, between you and Gabriel it a) now works and b) is neater code.thanks -- 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-

Re: list comprehension query

2013-05-03 Thread Gabriel
Hey Mike, Great to know it's working but take a look at the rest of the stuff I and specially Tom said. You'll end up with a smaller, simpler and easier to read function. - Gabe On Fri, May 3, 2013 at 12:08 PM, MikeKJ wrote: > > Kudos Gabriel, item_id wasn't an int, I thought I'd check that 1s

Re: Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Branko Majic
On Fri, 3 May 2013 15:31:05 +0100 Darren Mansell wrote: > I had rsync'd the code onto the live server from /home/django/rfc/ > into /home/django/rfc/rfc. As it's inside the pythonpath, the code is > still valid and will be executed, especially when you have various > stuff in the same dir names a

Re: list comprehension query

2013-05-03 Thread MikeKJ
Kudos Gabriel, item_id wasn't an int, I thought I'd check that 1st it is now working... thank you -- 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+

Re: list comprehension query

2013-05-03 Thread Tom Evans
On Fri, May 3, 2013 at 2:32 PM, MikeKJ wrote: > I am using enumerate to find the position in a list but it doesnt seem to be > working or throwing an error any ideas please? "Not working" is not a very good description of what is going wrong. If it did throw an error, not including it is also a b

Re: list comprehension query

2013-05-03 Thread MikeKJ
Yeah trying to debug it. I know each element will be unique as item_id is the row id of a table I just need to know it's position so I can determine if there is a previous and next and from the list get the item_id of the previous and next values in the list which will eventually be passed thr

Re: list comprehension query

2013-05-03 Thread Gabriel
Hey Mike, Could you tell us what it is that you're expecting from the code? There's a couple of things in it that I couldn't understand: 1. Why are you raising a NameError exception for every element in get? Is that supposed to be debugging to find out if the loop is running? 2. What are

Re: Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Darren Mansell
Solved. To anyone who may come across this very obscure issue for themselves, it's entirely an error specific to my setup. I had rsync'd the code onto the live server from /home/django/rfc/ into /home/django/rfc/rfc. As it's inside the pythonpath, the code is still valid and will be executed, esp

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Shawn Milochik
On Fri, May 3, 2013 at 10:22 AM, Marc wrote: Thanks. I understood and that doesn't work for my project as python/django > can't handle the returned bytes I need to use. > my project requires that the values are stored using the result of > aes_encrypt from MySQL because other systems not made in

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Marc
Thanks. I understood and that doesn't work for my project as python/django can't handle the returned bytes I need to use. my project requires that the values are stored using the result of aes_encrypt from MySQL because other systems not made in python expect that and cannot be changed at this stag

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Shawn Milochik
On Fri, May 3, 2013 at 8:37 AM, Marc wrote: So Tom: i can't use those methods Shawn pointed out? What I was hoping I > can do is override the code that builds the SQL query. > Further looking I think thats correct; as I did get a module working I > found and played with which uses those methods

Re: Form constructor: Learn model instance for ModelChoiceField?

2013-05-03 Thread MikeKJ
have you checked out forms.ModelForm? from django.forms import ModelForm I may be completely wrong, I often am -- 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

list comprehension query

2013-05-03 Thread MikeKJ
I am using enumerate to find the position in a list but it doesnt seem to be working or throwing an error any ideas please? def detail(request, item_id): item = Item.objects.get(pk=item_id) list = [] count = Item.objects.all().count() all = Item.objects.all() for y in all:

Re: Creating Tables w/o SyncDB (Django ORM)

2013-05-03 Thread Tom Evans
On Fri, May 3, 2013 at 2:01 PM, Christian Schmitt wrote: > Hi there, > is there a possible way of creating tables with Django's ORM w/o SyncDB. It > would be really helpfull, to make new tables while doing some UI > interactions. > Do you want to do everything exactly that syncdb would do? from

Form constructor: Learn model instance for ModelChoiceField?

2013-05-03 Thread Carsten Fuchs
Hi all, is it possible to obtain the model instance for a ModelChoiceField in the constructor of the Form? Here is a short example that illustrates the problem: ~~ class Department(models.Model): pass class Staff(models.Model): departments =

Creating Tables w/o SyncDB (Django ORM)

2013-05-03 Thread Christian Schmitt
Hi there, is there a possible way of creating tables with Django's ORM w/o SyncDB. It would be really helpfull, to make new tables while doing some UI interactions. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

Re: Help Required on DB Connection and Data Access

2013-05-03 Thread Hannu Krosing
On 05/03/2013 03:48 PM, Lakshmi Prasad wrote: > Hi > > I am new to Python-Django Development > > we have one django application running on windows machine and DB which > I needs to access is from Linux machine. First of all I want to > connect to Linux machine and I need to access the DB table

Help Required on DB Connection and Data Access

2013-05-03 Thread Lakshmi Prasad
Hi I am new to Python-Django Development we have one django application running on windows machine and DB which I needs to access is from Linux machine. First of all I want to connect to Linux machine and I need to access the DB tables from my windows machine. Please help me to write conn

Re: Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Darren Mansell
On 3 May 2013 13:06, Tom Evans wrote: > On Fri, May 3, 2013 at 12:38 PM, Darren Mansell > wrote: > > > > Another bit of info, just in case anyone is currently looking at this.. > > > > The error is coming from > > > /usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py > > >

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Marc
I really think django should add an easy way to override what django uses to build the query for each Field and make it part of the Field settings, for example: models.CharField(override_sql_newupdate='AES_ENCRYPT(fieldname,key)', override_sql_select='AES_DECRYPT(fieldname,key)',... would be very

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Marc
So Tom: i can't use those methods Shawn pointed out? What I was hoping I can do is override the code that builds the SQL query. Further looking I think thats correct; as I did get a module working I found and played with which uses those methods and they don't seem to manipulate the query that is

best way to track flatpages clicked by users?

2013-05-03 Thread frocco
Hello, I am looking for a way to track links clicked on my website, so I can see what is being used. Most pages are flat pages, so our my own design. Thanks Frank -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Tom Evans
On Fri, May 3, 2013 at 12:46 PM, Shawn Milochik wrote: > https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#converting-database-values-to-python-objects > https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#converting-python-objects-to-query-values > > Have a look at the

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Shawn Milochik
On Fri, May 3, 2013 at 8:06 AM, Marc wrote: Thanks, i'll play with that and see what I can come up with. > Docs are good, but sometimes really hard to read/find what you need :) > > > > Oh come on, you mean "get_prep_value" and "to_python" weren't obvious? ;o) -- You received this message becau

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Marc
Thanks, i'll play with that and see what I can come up with. Docs are good, but sometimes really hard to read/find what you need :) On Fri, May 3, 2013 at 7:46 AM, Shawn Milochik wrote: > > https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#converting-database-values-to-python-obj

Re: Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Tom Evans
On Fri, May 3, 2013 at 12:38 PM, Darren Mansell wrote: > > Another bit of info, just in case anyone is currently looking at this.. > > The error is coming from > /usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py > > … > > So it's failing validation because it's seeing the

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Shawn Milochik
https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#converting-database-values-to-python-objects https://docs.djangoproject.com/en/1.5/howto/custom-model-fields/#converting-python-objects-to-query-values Have a look at these two methods of a custom field. You can pretty easily make yo

set initial data to django-haystacks FacetedSearchForm

2013-05-03 Thread Amyth Arora
I have been digging around for about 24 hours now and am still not able to solve this. I am using a 'haystack.forms.FacetedSearchForm' and want set some initial field values to some of the form fields. Here are some more details on what I am trying to do. http://stackoverflow.com/questions/1634

Re: How do I test a function that calls a web API?

2013-05-03 Thread Vineet Naik
Hi Mike, you can use the mock[1] library for this. [1]: http://www.voidspace.org.uk/python/mock/ On Fri, May 3, 2013 at 11:09 AM, Mike wrote: > I'm starting to write tests for my Django project but I'm not sure how to > test a function that calls out to a web API. I read somewhere that I > s

Re: Admin module - modify SQL Query used for Edit and Save Models

2013-05-03 Thread Marc R
Anyone? I would really like to know who I can modify the query as its being built so that for a specific field I can set the "field" to AES_DECRTYP(fieldname,key) on a select and AES_ENCRYPT(fieldname,key) on insert/update On Sunday, 28 April 2013 20:21:48 UTC-4, Marc R wrote: > > I have a mode

Re: Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Darren Mansell
Another bit of info, just in case anyone is currently looking at this.. The error is coming from /usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py class BooleanField(Field): empty_strings_allowed = False default_error_messages = { *'invalid': _("'%s' value

Re: how to get called function automatically inside views.py?

2013-05-03 Thread Timothy Makobu
I would do this by having the view exposed on a url like 127.0.0.1:8000/myview and having that called from cron via curl, a python script utilizing urllib. On Fri, May 3, 2013 at 1:37 PM, Avnesh Shakya wrote: > thanks but if i want to get a function called autometically, when i run > 127.0.0.1:

Re: how to get called function automatically inside views.py?

2013-05-03 Thread Avnesh Shakya
thanks but if i want to get a function called autometically, when i run 127.0.0.1:8000/ which defined inside views.py. how is it possible. On Fri, May 3, 2013 at 4:00 PM, Tom Evans wrote: > On Fri, May 3, 2013 at 11:04 AM, Avnesh Shakya > wrote: > > hi, please tell me. it's urgent. > > > > "i

Re: how to get called function automatically inside views.py?

2013-05-03 Thread Tom Evans
On Fri, May 3, 2013 at 11:04 AM, Avnesh Shakya wrote: > hi, please tell me. it's urgent. > "its urgent". Sorry, couldn't resist. As this seems to have nothing to do with django, and a lot to do with "apscheduler", perhaps you should ask the apscheduler folks instead? Cheers Tom -- You receiv

Re: Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Darren Mansell
Bit more info (all pointing to the same database / db server): test server with Django dev server : works test server with Apache 2.2.22-6ubuntu5 / mod-wsgi 3.4-0ubuntu3 : works live server with Django dev server : works live server with Apache 2.2.22-1ubuntu1.3 / mod-wsgi 3.3-4build1 : doesn't w

Re: how to get called function automatically inside views.py?

2013-05-03 Thread Avnesh Shakya
hi, please tell me. it's urgent. On Thursday, May 2, 2013 7:01:33 PM UTC+5:30, Avnesh Shakya wrote: > > > hi, > I am creating a function inside the views.py, I want to call this > function automatically according to timing which i m using through > apscheduler. how is it possible, please tel

Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Darren Mansell
Hi all. Really really confused by this one. Can someone show me where I'm being stupid please? Standard Django 1.5.1 app with MySQL. Trying to save to a VARCHAR(3) column with a forms.CharField form field and a models.CharField model field. When I try to save the form I get this validation error:

css and js in working in my project.

2013-05-03 Thread Avnesh Shakya
hi, css and js file in not working in my project, please tell me about it, I am unable to get problem. my project is learnt. learnt > apps > lrntkr(my app) > models.py and views.py. learnt > learnt > settings.py and urls.py and wsgi.py. learnt > static > javascripts and stylesheet and other

Re: How do I test a function that calls a web API?

2013-05-03 Thread Russell Keith-Magee
Hi Mike, I can see two options. Option 1: factor the external service API calls behind some sort of interface that can be swapped out at runtime. However, this means a lot of extra work if the interface will only be used for testing. Option 2: look into using Mock [1] [1] http://www.voidspace.