please help: problem saving strings to the database

2014-11-21 Thread Sabine Maennel
Hello,

I do not know why this is happening: If I try to update a database record 
the text gets into the field the wrong way:

models.py

from model_utils.models import TimeStampedModel

class ClassroomLog(TimeStampedModel):
...
text = models.TextField()

then somewhere else I put data in that database like that:

...
log = ClassroomLog.objects.get(...)
log.text = "Hallo"
log.save()

then the field in the database will contain this:

('Hallo',) 

What am I doing wrong here?

If I do this instead: 

...
log = ClassroomLog.objects.get(...)
log.delete()
log = ClassroomLog(..., text = "Hallo", ...)
log.save()

it works out as expected and the admin of the database shows for 
list_display = ('text',): 

Hallo  

Can someone please help me with this. I tried for quite a while, but could 
not figure out what is happening.

 with kind regards and thanks in advance
 Sabine

-- 
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/b4ec4fb8-050b-45e3-9d3a-862e6aaf7fe4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem in deploying Django 1.7 application using openshift.

2014-11-21 Thread Girish Joshi
I did not find the correct and clear instructions for bootstrapping and 
settings of django1.7 application for Openshift.
from these two links
https://stackoverflow.com/questions/26871381/deploying-a-local-django-app-using-openshift
 

and
https://github.com/jfmatth/openshift-django17 

I figured out the correct directory structure and settings required to 
deploy Django1.7 application on Openshift.
I have written this script to bootstrap the Django application for Openshift
https://github.com/girish946/Power-Django-Openshift 

now it works fine for me. 

thank you,
girish.

On Monday, 17 November 2014 21:39:20 UTC+5:30, Girish Joshi wrote:
>
> Hello all,
> I want to deploy Django 1.7 application on openshift.
> I've tried the steps given at 
> https://stackoverflow.com/questions/26871381/deploying-a-local-django-app-using-openshift
> but I'm getting 
>
> 503 Service Unavailable No server is available to handle this request. 
>
> Error message.
>
> can anyone please tell me the correct way to deploy the  Django 1.7 
> application on openshift.
>
> thank you!
> girish.
>

-- 
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/31e5a560-7026-492e-ad66-177a48d089b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django translate not translating jinja templates

2014-11-21 Thread Tom Hamilton Stubber
Hi all,

I have a project that is being translated fine for the most part, but my 
jinja templates aren't working. If I reference them in the django.po file 
and then compilemessages, the page loads fine with my translations.

However, if I makemessages then my entries in the .po get commented out.

Any ideas?

Cheers

-- 
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/7b7ec680-6f30-4722-858f-cea1e0635567%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: please help: problem saving strings to the database

2014-11-21 Thread Tiago Almeida
Check if you have a comma after the string.

 log = ClassroomLog.objects.get(...)
log.text = "Hallo"*,*
log.save()

Sexta-feira, 21 de Novembro de 2014 11:57:40 UTC, Sabine Maennel escreveu:
>
> Hello,
>
> I do not know why this is happening: If I try to update a database record 
> the text gets into the field the wrong way:
>
> models.py
>
> from model_utils.models import TimeStampedModel
>
> class ClassroomLog(TimeStampedModel):
> ...
> text = models.TextField()
>
> then somewhere else I put data in that database like that:
>
> ...
> log = ClassroomLog.objects.get(...)
> log.text = "Hallo"
> log.save()
>
> then the field in the database will contain this:
>
> ('Hallo',) 
>
> What am I doing wrong here?
>
> If I do this instead: 
>
> ...
> log = ClassroomLog.objects.get(...)
> log.delete()
> log = ClassroomLog(..., text = "Hallo", ...)
> log.save()
>
> it works out as expected and the admin of the database shows for 
> list_display = ('text',): 
>
> Hallo  
>
> Can someone please help me with this. I tried for quite a while, but could 
> not figure out what is happening.
>
>  with kind regards and thanks in advance
>  Sabine
>
>

-- 
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/b34a0862-820a-49eb-beb1-dd3a1593c942%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Web and mobile app with Django? Kivy? sth else?

2014-11-21 Thread Mariusz Wilk
I'm new to programming. Eventually, I'd like to make a website and an 
android/ios app that would work together and display pretty much the same 
content on a mobile as on the the web. Each client would log in (via mobile 
or desktop) and continue solving some exercises from the place he 
previously finished at. I have a potential client for this app, I don't 
have any deadline and if it works fine I shouldn't have any problems 
selling it to him and getting some commercial experience! So my question 
is: *what should I be learning to eventually reach this goal?* I've done a 
few Python tutorials/courses online, I played around with HTML, CSS and JS, 
right now I'm learning Kivy. Django scared me a lot, but maybe I should 
give it another try.

-- 
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/18d268ec-e509-4d39-8d9d-ac74204123f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form doesn't show in HTML template

2014-11-21 Thread Some Developer

On 20/11/14 22:07, Vijay Khemlani wrote:

If you set the settings TEMPLATE_DEBUG to True, does it display any errors?



Hmm still been trying to figure out what is going on but haven't really 
managed to get very far. I'm completely stumped.


Has anyone got any tips as to what the problem might be?

--
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/546F5A22.8030505%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form doesn't show in HTML template

2014-11-21 Thread Vijay Khemlani
If you manually call the form "as_p" method in the view (not the template),
does it print the form?

On Fri, Nov 21, 2014 at 12:28 PM, Some Developer 
wrote:

> On 20/11/14 22:07, Vijay Khemlani wrote:
>
>> If you set the settings TEMPLATE_DEBUG to True, does it display any
>> errors?
>>
>>
> Hmm still been trying to figure out what is going on but haven't really
> managed to get very far. I'm completely stumped.
>
> Has anyone got any tips as to what the problem might be?
>
> --
> 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/546F5A22.8030505%40googlemail.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/CALn3ei2YNH%3D4j9YWw%2BsYe-9ocZ-333rdaHbzXX-sdjvsFS8DAw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying Django project

2014-11-21 Thread Fred Stluka

Mulianto,

You said:
Fred way is good, but need time to type and remember all the steps. 
WIth fabric you will not miss a step and it can be automated.



I think you misunderstood my post.  The commands I showed
are excerpts from my automated script.  I provided them so
termopro could write such a script of his own.  I don't type all
of those commands each time.  I just type: *pub*

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/20/14 7:50 PM, Phang Mulianto wrote:

Hi termopro,

TO automate the deployment, look for fabric + cuisie (CHef like fabric) .

You will bored with the command line in each deployment, and you will 
need fast and standard way of deploying to each new machine.


Fred way is good, but need time to type and remember all the steps. 
WIth fabric you will not miss a step and it can be automated.


Git is you friend here. You can create a private repo in your prod 
machine, and make the code pull from the repo for production 
deployment when you push from dev to prod with hook script (Automate 
again)


BUt make sure the code tested before go production with this way.

Regards,

Mulianto

Blog: http://muliantophang.blogspot.com

On Fri, Nov 21, 2014 at 7:37 AM, Fred Stluka > wrote:


termopro,

I have automated my deployments mostly separate from my
version control.

The other team members and I write, test, commit, and push our
code changes to our Git repo.  I then pull, review, test, update
the version number, commit, tag, and push to Git.

Then I use a shell script (on Mac, but would work on Unix/Linux
also) to push the tagged commit to TEST and later to PROD.

My script does things like:

- Get the latest files from Git before, and back to master after:
   % git checkout mytag
   ...
   % git checkout master

- Create folder of collected static files before, and delete after:
   % mkdir -pv collected_static/mytag
   % python manage.py collectstatic --clear --noinput
   ...
   % rm -rfv collected_static

- Delete all local *.pyc files:
   % find . -name \*.pyc -exec rm -v "{}" ";"

- Insert PROD password into local settings file (PROD pushes
   only) before, and remove after:
   % sed -i .old -e "s/PUT_PROD_PASSWORD_HERE/`cat prod_pw`/g"
settings.py
   ...
   % mv -v settings.py.old settings.py

- Show a warning banner at the Web site to say it is going down
   briefly, and clear the banner after:
   % ssh -t myserver.mydomain.com 
cp -v
/var/www/django/myapp/templates/myapp/site_alert_maintenance.html
site_alert.html
   % sleep 60
   ...
   % ssh -t myserver.mydomain.com 
cp -v /var/www/django/myapp/templates/myapp/site_alert_none.html
site_alert.html

- Push the local files to the TEST or PROD server:
   %  rsync -v --progress -i -l --rsh=ssh -r --del myapp
myserver.mydomain.com:/var/www/django

- Run all migrations on the server
   % ssh -t myserver.mydomain.com 
python manage.py migrate --all

- Stop the Apache server, delete all remote *.pyc files, and
   restart the server:
   % ssh -t myserver.mydomain.com 
sudo /etc/init.d/httpd stop
   % ssh -t myserver.mydomain.com 
sudo find /var/www/django/myapp -name \*.pyc -exec rm -v "{}" ";"
   % ssh -t myserver.mydomain.com 
sudo /etc/init.d/httpd start

Plus a few other actions that are specific to our app, and lots
or informational messages, prompts, confirmations, etc. Also,
some of these steps are combined into a remote script that
runs on the server to reduce the number of "ssh -t sudo"
commands I would otherwise have to do.  But, that's the gist
of it.

Hope this helps!
--Fred

Fred Stluka -- mailto:f...@bristle.com --
http://bristle.com/~fred/ 
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 11/19/14 5:22 AM, termopro wrote:


I have created a Django 1.7 project and would like to deploy it.
I am reading about how to do it right and i have some questions.

If i understand correctly deployment should contain the following
steps:

1) Initial remote machine set up:

  * a) i

Re: django.contrib.comments depreciated, any good alternatives?

2014-11-21 Thread Scot Hacker


On Thursday, November 20, 2014 10:35:18 PM UTC-8, Code wrote:
>
> Hi,
>
> I have been facing a nightmare with django comments app.
>
> see: https://groups.google.com/forum/#!topic/django-users/7B2umISG-9I
>
> I found out it has been depreciated and so wanted to know suitable 
> alternatives. Disqus is one but is this suitable for local environment, I 
> am a beginner so need a little help with this. Also, Are there any other 
> good alternatives?  
>

Just because it's deprecated as part of core doesn't mean the software is 
unavailable. It's been moved over to its own repo as "extcontrib":

https://github.com/django/django-contrib-comments

 It's still a perfectly fine reusable django app; just no longer part of 
core. Remove references to the old official one in your project and install 
excontrib via:

http://django-contrib-comments.readthedocs.org/en/latest/quickstart.html

./s

-- 
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/c71b56d5-8590-415c-a349-ed483a9268d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form doesn't show in HTML template

2014-11-21 Thread Some Developer

On 21/11/14 15:31, Vijay Khemlani wrote:

If you manually call the form "as_p" method in the view (not the
template), does it print the form?



Which method in the FormView class would I override to put that in?
The get() method or the render_to_response() method?

--
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/546F61B2.5030905%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Form doesn't show in HTML template

2014-11-21 Thread Some Developer

On 21/11/14 15:31, Vijay Khemlani wrote:

If you manually call the form "as_p" method in the view (not the
template), does it print the form?



OK. Sorted that out.

Running my program through the debugger shows that the form object 
exists and has the correct fields associated with it.


I don't understand this. Everything I look at says that the form should 
display correctly and it just isn't. The form_class has been 
instantiated correctly, there are no errors or warnings when I run my 
code. The template gets the form object passed to it as a context 
object. The only thing that doesn't happen is the form being displayed.


Very strange indeed.

--
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/546F692D.3080803%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploying Django project

2014-11-21 Thread Phang Mulianto
Hi Fred,

Sory for the missunderstanding ...

i just remember my first time deploying manually with all the typing and
typo and the step.. :)

Cheers

Mulianto

On Fri, Nov 21, 2014 at 11:42 PM, Fred Stluka  wrote:

>  Mulianto,
>
> You said:
>
> Fred way is good, but need time to type and remember all the steps. WIth
> fabric you will not miss a step and it can be automated.
>
>  I think you misunderstood my post.  The commands I showed
> are excerpts from my automated script.  I provided them so
> termopro could write such a script of his own.  I don't type all
> of those commands each time.  I just type:  *pub*
>
> --Fred
> --
> Fred Stluka -- mailto:f...@bristle.com  --
> http://bristle.com/~fred/
> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
> Open Source: Without walls and fences, we need no Windows or Gates.
> --
>  On 11/20/14 7:50 PM, Phang Mulianto wrote:
>
> Hi termopro,
>
>  TO automate the deployment, look for fabric + cuisie (CHef like fabric) .
>
>  You will bored with the command line in each deployment, and you will
> need fast and standard way of deploying to each new machine.
>
>  Fred way is good, but need time to type and remember all the steps. WIth
> fabric you will not miss a step and it can be automated.
>
>  Git is you friend here. You can create a private repo in your prod
> machine, and make the code pull from the repo for production deployment
> when you push from dev to prod with hook script (Automate again)
>
>  BUt make sure the code tested before go production with this way.
>
>  Regards,
>
> Mulianto
>
>  Blog: http://muliantophang.blogspot.com
>
> On Fri, Nov 21, 2014 at 7:37 AM, Fred Stluka  wrote:
>
>>  termopro,
>>
>> I have automated my deployments mostly separate from my
>> version control.
>>
>> The other team members and I write, test, commit, and push our
>> code changes to our Git repo.  I then pull, review, test, update
>> the version number, commit, tag, and push to Git.
>>
>> Then I use a shell script (on Mac, but would work on Unix/Linux
>> also) to push the tagged commit to TEST and later to PROD.
>>
>> My script does things like:
>>
>> - Get the latest files from Git before, and back to master after:
>>% git checkout mytag
>>...
>>% git checkout master
>>
>> - Create folder of collected static files before, and delete after:
>>% mkdir -pv collected_static/mytag
>>% python manage.py collectstatic --clear --noinput
>>...
>>% rm -rfv collected_static
>>
>> - Delete all local *.pyc files:
>>% find . -name \*.pyc -exec rm -v "{}" ";"
>>
>> - Insert PROD password into local settings file (PROD pushes
>>only) before, and remove after:
>>% sed -i .old -e "s/PUT_PROD_PASSWORD_HERE/`cat prod_pw`/g" settings.py
>>...
>>% mv -v settings.py.old settings.py
>>
>> - Show a warning banner at the Web site to say it is going down
>>briefly, and clear the banner after:
>>% ssh -t myserver.mydomain.com cp -v
>> /var/www/django/myapp/templates/myapp/site_alert_maintenance.html
>> site_alert.html
>>% sleep 60
>>...
>>% ssh -t myserver.mydomain.com cp -v
>> /var/www/django/myapp/templates/myapp/site_alert_none.html site_alert.html
>>
>> - Push the local files to the TEST or PROD server:
>>%  rsync -v --progress -i -l --rsh=ssh -r --del myapp
>> myserver.mydomain.com:/var/www/django
>>
>> - Run all migrations on the server
>>% ssh -t myserver.mydomain.com python manage.py migrate --all
>>
>> - Stop the Apache server, delete all remote *.pyc files, and
>>restart the server:
>>% ssh -t myserver.mydomain.com sudo /etc/init.d/httpd stop
>>% ssh -t myserver.mydomain.com sudo find /var/www/django/myapp -name
>> \*.pyc -exec rm -v "{}" ";"
>>% ssh -t myserver.mydomain.com sudo /etc/init.d/httpd start
>>
>> Plus a few other actions that are specific to our app, and lots
>> or informational messages, prompts, confirmations, etc.  Also,
>> some of these steps are combined into a remote script that
>> runs on the server to reduce the number of "ssh -t sudo"
>> commands I would otherwise have to do.  But, that's the gist
>> of it.
>>
>> Hope this helps!
>> --Fred
>> --
>> Fred Stluka -- mailto:f...@bristle.com  --
>> http://bristle.com/~fred/
>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
>> Open Source: Without walls and fences, we need no Windows or Gates.
>> --
>>   On 11/19/14 5:22 AM, termopro wrote:
>>
>>  I have created a Django 1.7 project and would like to deploy it. I am
>> reading about how to do it right and i have some questions.
>>
>> If i understand correctly deployment should contain the following steps:
>>
>> 1) Initial remote machine set up:
>>
>>- a) install os / server / database / cache ...
>>- b) install Django and required modules
>>- c) update database with real data
>>
>> 2) Upload code/ database chan

django-locking

2014-11-21 Thread ian . k
Hi everyone,

I'm posting new message because I have a different question. Has anyone had 
any luck using django-locking (https://github.com/RobCombs/django-locking) 
with a modern version of Django's admin interface? 

I've got it mostly working with my project. Basically Django is set up to 
add and remove fields from "Configuration"s. We have our own database 
object called "Configuration", with a number of fields that the admin 
interface edits. You can create more than one Configuration, and edit 
existing ones. (This is what we're trying to add locking to.)

Right now, when we go in to edit a Configuration, there's a 404 error in 
the console when it tries to access 
/admin/ajax/test/common/configuration/is_locked/?_=1416587837817.


It looks like it for some reason is not checking the lock on a specific 
Configuration. I think it should be doing this: 
/admin/ajax/test/common/configuration/1/is_locked/?_=1416587837817.


So I went to my browser, and tried accessing 
/admin/ajax/test/common/configuration/1/is_locked/?_=1416587837817. This 
gives a 404, 
saying configuration object with primary key u'1/is_locked' does not exist.

So I think there's two issues here:
1. It is not checking the lock status for a specific Configuration. (not 
adding the /1/ )
2. Even if it does, it is getting an error when it tries to look for 
is_locked in the database?

Does anyone know how to fix either of these issues?
I'm on Django 1.6.8, and using the latest version of django-locking from 
the GitHub page.

Any help would be greatly appreciated. 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+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/4b8665c7-c4da-443d-80a4-7a389f500367%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: please help: problem saving strings to the database

2014-11-21 Thread Szymon Krzemiński
Looks like the record is stored as a one-element tuple. Don't know what's 
the source of this behaviour yet, though.

W dniu piątek, 21 listopada 2014 12:57:40 UTC+1 użytkownik Sabine Maennel 
napisał:
>
> Hello,
>
> I do not know why this is happening: If I try to update a database record 
> the text gets into the field the wrong way:
>
> models.py
>
> from model_utils.models import TimeStampedModel
>
> class ClassroomLog(TimeStampedModel):
> ...
> text = models.TextField()
>
> then somewhere else I put data in that database like that:
>
> ...
> log = ClassroomLog.objects.get(...)
> log.text = "Hallo"
> log.save()
>
> then the field in the database will contain this:
>
> ('Hallo',) 
>
> What am I doing wrong here?
>
> If I do this instead: 
>
> ...
> log = ClassroomLog.objects.get(...)
> log.delete()
> log = ClassroomLog(..., text = "Hallo", ...)
> log.save()
>
> it works out as expected and the admin of the database shows for 
> list_display = ('text',): 
>
> Hallo  
>
> Can someone please help me with this. I tried for quite a while, but could 
> not figure out what is happening.
>
>  with kind regards and thanks in advance
>  Sabine
>
>

-- 
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/69db39c8-0fb5-4d6a-8fe2-58883075b966%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2014-11-21 Thread Andreas Ka
I don't know.
How to test that?



The things I have done were these:
https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customizing-your-project-s-templates

mkdir templates
mkdir templates/admin
cp
/usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/base_site.html
templates/admin/

ls -l templates/admin/base_site.html
-rw-r--r-- 1 user group 338 Nov 21 18:50 templates/admin/base_site.html
(and www-data is member of that group)

nano templates/admin/base_site.html   -> changed it to what I want to see
nano mysite/settings.py  -->   TEMPLATE_DIRS = [os.path.join(BASE_DIR,
'templates')]

restarted the server.







On Fri, Nov 21, 2014 at 3:24 AM, Collin Anderson 
wrote:

> Hi,
>
> Do other templates work in that folder?
>
> Collin
>
>
> On Monday, November 17, 2014 4:12:27 PM UTC-5, Andreas Ka wrote:
>
>>
>> > Show your view code
>> The tutorial did not create any view.py for the admin pages
>>
>>
>>
>> See https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-
>> the-admin-look-and-feel
>>
>> We copied from the Django source files these two into:
>> /mysite/templates/admin/base_site.html
>> and
>> /mysite/templates/admin/index.html
>>
>>
>>
>> and in https://docs.djangoproject.com/en/1.7/intro/tutorial02/#
>> customize-the-admin-change-list
>> edited:
>>
>>
>> admin.py
>>
>> from django.contrib import admin
>>
>> # Register your models here.
>>
>> from django.contrib import admin
>> from polls.models import Choice, Question
>>
>>
>> class ChoiceInline(admin.TabularInline):
>> model = Choice
>> extra = 3
>>
>>
>> class QuestionAdmin(admin.ModelAdmin):
>> fieldsets = [
>> (None,   {'fields': ['question_text']}),
>> ('Date information', {'fields': ['pub_date'], 'classes':
>> ['collapse']}),
>> ]
>> inlines = [ChoiceInline]
>> list_display = ('question_text', 'pub_date', 'was_published_recently')
>> list_filter = ['pub_date']
>> search_fields = ['question_text']
>>
>> admin.site.register(Question, QuestionAdmin)
>>
>>
>> ---
>>
>>
>>
>> On Mon, Nov 17, 2014 at 2:11 PM, Artie  wrote:
>>
>>> Are you sure about correct path to your templates in views?
>>>
>>> Show your view code
>>>
>>> понедельник, 17 ноября 2014 г., 5:04:53 UTC+2 пользователь Andreas Ka
>>> написал:

 thanks for your answer.

 yes, I just tried that. Same result.

>>>
>>
>>> By now, I have understood much more about the templates.

>>>
>>
>>> But still, for the admin pages
 mysite/templates/admin/base_site.html
 doesn't work yet.


 ...

>>>
>> On Sun, Nov 16, 2014 at 7:19 PM, RLF_UNIQUE  wrote:
>>
>>> Obviously you've restarted the server and refreshed the page in such a
>>> way to ensure it's not a caching issue ?
>>
>>
>>
>>
>>
>  --
> 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/4062bb51-88cd-4c2f-9430-bd6ab87c8902%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/CAJAOMej0dhMMhYMCZvP-0o2nX6nXxv7-3KWsL8r3X_Y5nqm44A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Is it wrong to disable a lot of the core django features?

2014-11-21 Thread John Rodkey
We are evaluating django for a new internal CRM project and have issues 
using many of the built in features including: the base user, permissions, 
and authentication.

We do not wish to use the built-in admin...  The level of complexity for 
our permissions will be based on the employees job function/role.  While 
django does offer "Groups" under permissions, we have many subsidiaries 
which may name their own groups, this is our reasoning for dumping the 
built-in permissions.

What we are trying to accomplish -

1. User registration and authorization based on users email address. (We 
believe this could be created with the "Custom User" information found in 
the docs.)

2. Depending on the users email domain (the subsidiary) they work for, they 
will only have access to that data (We do not believe django offers this, 
and will be building it)

3. Each company (subsidiary) will have their own permission roles/groups 
(We do not believe this is available in django, please correct if wrong).

4. Each user will be assigned role(s)/permission(s) for their company (We 
believe this will need to be a custom tool)


Is there a simple solution to altering the built-in authentication and 
permission to fit our needs?  


-- 
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/08b6701d-0a6f-45e1-bda8-177785dd33cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ImportError: cannot import name 'GEOSException'

2014-11-21 Thread jogaserbia
Hi All,

Thanks very much for the help.  I managed to figure it out with tips for 
both of you. 

I am not sure exactly what helped finally fix it but:

1) I changed my python version from 64 bit to 32 bit
2) The script in that updated the path variables were pretty messed up, so 
I manually changed them to what they should have been. 
2) I had incorrectly added the GEOS_LIBRARY_PATH of

C:\program files\OSGeo4W\bin\geos_c.dll  

but I should have added:

C:\OSGeo4W\bin\geos_c.dll 

Now, I can just delete the GEOS_LIBRARY_PATH from the project settings and 
things still work, so I guess it must have been the 64 bit vs 32 bit issue, 
or the path issue.  

Thanks again for the advice. 

Ivan

-- 
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/05ba169a-f223-4d48-b445-368bebb530cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it wrong to disable a lot of the core django features?

2014-11-21 Thread Carl Meyer
Hi John,

I'll start with answering the question in your subject: no. There's
nothing at all wrong with using the parts of Django that are useful to
you, and not using the ones that aren't.

In particular, auth and admin are part of "contrib"; that is, useful
applications built on top of Django and shipped with it. They aren't
even part of Django core. All of contrib is meant to be entirely optional.

On 11/21/2014 01:18 PM, John Rodkey wrote:
> We are evaluating django for a new internal CRM project and have issues 
> using many of the built in features including: the base user, permissions, 
> and authentication.
> 
> We do not wish to use the built-in admin...  The level of complexity for 
> our permissions will be based on the employees job function/role.  While 
> django does offer "Groups" under permissions, we have many subsidiaries 
> which may name their own groups, this is our reasoning for dumping the 
> built-in permissions.
> 
> What we are trying to accomplish -
> 
> 1. User registration and authorization based on users email address. (We 
> believe this could be created with the "Custom User" information found in 
> the docs.)

Yes, that's right.

> 2. Depending on the users email domain (the subsidiary) they work for, they 
> will only have access to that data (We do not believe django offers this, 
> and will be building it)
> 
> 3. Each company (subsidiary) will have their own permission roles/groups 
> (We do not believe this is available in django, please correct if wrong).
> 
> 4. Each user will be assigned role(s)/permission(s) for their company (We 
> believe this will need to be a custom tool)
> 
> 
> Is there a simple solution to altering the built-in authentication and 
> permission to fit our needs?

The built in groups/permissions system is fairly limited: based on your
needs, I think you may be better off building that yourself.

If I were you, I would use the built-in auth system (but with a custom
User model) -- it's pretty flexible these days, and using it will give
you better interoperability with many parts of the Django ecosystem. If
your custom User model inherits from AbstractBaseUser (not AbstractUser)
it won't have the many-to-many relationships with Permission and Group,
and you can just ignore them and build your own permission/roles system
instead.

Carl

-- 
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/546FA2B3.7010109%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: Is it wrong to disable a lot of the core django features?

2014-11-21 Thread John Rodkey
Hi Carl,

Thank you for the quick answer.  Using your recommendation, can we simply 
disable the admin, groups and permissions, but still use the Authentication 
(login/sessions)?  

We will create our own authorization module for permissions/roles and 
groups.

Best,
John


On Friday, November 21, 2014 2:38:38 PM UTC-6, Carl Meyer wrote:
>
> Hi John, 
>
> I'll start with answering the question in your subject: no. There's 
> nothing at all wrong with using the parts of Django that are useful to 
> you, and not using the ones that aren't. 
>
> In particular, auth and admin are part of "contrib"; that is, useful 
> applications built on top of Django and shipped with it. They aren't 
> even part of Django core. All of contrib is meant to be entirely optional. 
>
> On 11/21/2014 01:18 PM, John Rodkey wrote: 
> > We are evaluating django for a new internal CRM project and have issues 
> > using many of the built in features including: the base user, 
> permissions, 
> > and authentication. 
> > 
> > We do not wish to use the built-in admin...  The level of complexity for 
> > our permissions will be based on the employees job function/role.  While 
> > django does offer "Groups" under permissions, we have many subsidiaries 
> > which may name their own groups, this is our reasoning for dumping the 
> > built-in permissions. 
> > 
> > What we are trying to accomplish - 
> > 
> > 1. User registration and authorization based on users email address. (We 
> > believe this could be created with the "Custom User" information found 
> in 
> > the docs.) 
>
> Yes, that's right. 
>
> > 2. Depending on the users email domain (the subsidiary) they work for, 
> they 
> > will only have access to that data (We do not believe django offers 
> this, 
> > and will be building it) 
> > 
> > 3. Each company (subsidiary) will have their own permission roles/groups 
> > (We do not believe this is available in django, please correct if 
> wrong). 
> > 
> > 4. Each user will be assigned role(s)/permission(s) for their company 
> (We 
> > believe this will need to be a custom tool) 
> > 
> > 
> > Is there a simple solution to altering the built-in authentication and 
> > permission to fit our needs? 
>
> The built in groups/permissions system is fairly limited: based on your 
> needs, I think you may be better off building that yourself. 
>
> If I were you, I would use the built-in auth system (but with a custom 
> User model) -- it's pretty flexible these days, and using it will give 
> you better interoperability with many parts of the Django ecosystem. If 
> your custom User model inherits from AbstractBaseUser (not AbstractUser) 
> it won't have the many-to-many relationships with Permission and Group, 
> and you can just ignore them and build your own permission/roles system 
> instead. 
>
> Carl 
>
>

-- 
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/acb9c119-1db9-4cdc-826e-b6fb2bcb3172%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it wrong to disable a lot of the core django features?

2014-11-21 Thread Carl Meyer
Hi John,

On 11/21/2014 02:33 PM, John Rodkey wrote:
> Thank you for the quick answer.  Using your recommendation, can we simply 
> disable the admin, groups and permissions, but still use the Authentication 
> (login/sessions)?  

The admin is already separate from auth, so that's easy to turn off.

With the built-in groups and permissions, you will still have tables for
them in the database, but they don't need to be linked to your custom
User class (as I described in my last mail), so you can basically just
ignore them and use your own authorization module instead.

Carl

-- 
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/546FB1B3.1010006%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: daterange filter

2014-11-21 Thread Collin Anderson
Hi,

I'm actually having a hard time seeing how your code matches up with the 
django-daterange-filter code you linked to.

One thing to try is to as much as possible use dates instead of datetimes, 
or otherwise, yes, you'll need to use timedelta(days=1).

Also, the "None" value means that they key is not present in cleaned_data, 
at least at that point.

Collin


On Tuesday, November 18, 2014 2:03:52 AM UTC-5, Sachin Tiwari wrote:
>
>
>
> On Saturday, November 15, 2014 4:47:12 PM UTC+5:30, Sachin Tiwari wrote:
>>
>> Hi All,
>>
>> I am using  below  daterange filter package but it did not work if 
>>  from_date and to_date field are same,
>>
>>
>> https://github.com/DXist/django-daterange-filter/blob/master/daterange_filter/filter.py
>>
>> Please suggest the solution
>>
>> I was trying by converting to_date + timedelta(days=1) but it gives below 
>> error 
>>
>>
>> time data '' does 
>> not match format '%Y-%m-%d'
>>
>>
>> Edited Code of above link
>>
>> import datetime
>>
>> to_date = self.form.fields.get('measureddate__lte')
>> #toDate = datetime.datetime.strptime('2014-11-15', "%Y-%m-%d").date()
>> toDate = datetime.datetime.strptime(to_date.__str__(), "%Y-%m-%d").date() 
>> //Error
>> toTotom = toDate + datetime.timedelta(days=1)
>> self.replace_value_with_definition('measureddate__lte', toTotom.__str__())
>>
>>
>>
>>
>> def replace_value_with_definition(self,key_to_find, definition):
>> for key in self.form.cleaned_data.keys():
>> if key == key_to_find:
>> self.form.cleaned_data[key] = definition
>> return self.form.cleaned_data
>>
>>
>>
>>
>>
>
> Hi Collin,
>
> Thanks for your kind support,
>
> Sharing more details,
>
> self.form.cleaned_data.get('measureddate__lte')
>
> gives below error,
>
> [u"'None' value has an invalid format. It must be in -MM-DD 
> HH:MM[:ss[.uu]][TZ] format."]
>
>
> Original implementation is available at above link,
>
> This filter does not show the event if both dates are same, for e.g. 
> from_date : 2014-11-18 to_date : 2014-11-18, then events of today date 
> will not be displayed.
>
> Please suggest the solution,
>
> class DateRangeForm(forms.Form):
>
> def __init__(self, *args, **kwargs):
> self.field_name = kwargs.pop('field_name')
> super(DateRangeForm, self).__init__(*args, **kwargs)
>
>
> self.fields['%s__gte' % self.field_name] = forms.DateField(
> label='', widget=forms.widgets.DateInput(format="%Y-%m-%d",
> attrs={'placeholder': _('From date')}), localize=True, 
> input_formats="%Y-%m-%d",
> required=False)
> self.fields['%s__lte' % self.field_name] = forms.DateField(
> label='', widget=forms.widgets.DateInput(format="%Y-%m-%d",
> attrs={'placeholder': _('To date')}), localize=True, 
> input_formats="%Y-%m-%d",
> required=False)
>
>
> class DateRangeFilter2(admin.filters.DateFieldListFilter):
> template = 'daterange_filter/filter.html'
>
> def __init__(self, field, request, params, model, model_admin, 
> field_path):
> super(DateRangeFilter2, self).__init__(
> field, request, params, model, model_admin, field_path)
>
> self.form = self.get_form(request)
> self.field_generic = '%s__' % field_path
> self.date_params = dict([(k, v) for k, v in params.items()
>  if k.startswith(self.field_generic)])
>
>  def expected_parameters(self):
> return [self.lookup_kwarg_since, self.lookup_kwarg_until]
>
> def get_form(self, request):
> return DateRangeForm(data=self.used_parameters,
>  field_name=self.field_path)
>
> def replace_value_with_definition(self,key_to_find, definition):
> for key in self.form.cleaned_data.keys():
> if key == key_to_find:
> self.form.cleaned_data[key] = definition
> return self.form.cleaned_data
>
> def queryset(self, request, queryset):
> if self.form.is_valid():
>
> 
> to_date = self.form.cleaned_data.get('measureddate__gte')
> #if isinstance(to_date, forms.DateField):
> #to_date = now.replace(hour=0, minute=0, second=0)
> 
> #from_date = self.form.fields.get('measureddate__lte')
> from_date = self.form.cleaned_data.get('measureddate__lte')
> #if isinstance(from_date, forms.DateField):
> #from_date = now.replace(hour=0, minute=0, second=0)
>
> #return 
> queryset.filter(measureddate__gte=datetime.date(from_date), 
> measureddate__lte=datetime.date(to_date))
> return queryset.filter(measureddate__gte=from_date.__str__(), 
> measureddate__lte=to_date.__str__())
>else:
> return queryset
>
> FieldListFilter.register(
> lambda f: isinstance(f, forms.DateField), DateFieldListFilter)
>
>
> [u"'None

Re: Want to change home->blog to Admin home -> blog

2014-11-21 Thread Collin Anderson
Hi,

Is your TEMPLATE_DIRS set correctly? The tutorial recommends this:

TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]

Thanks,
Collin



On Tuesday, November 18, 2014 2:06:35 AM UTC-5, Sachin Tiwari wrote:
>
>
>
> On Thursday, November 13, 2014 7:49:28 PM UTC+5:30, Sachin Tiwari wrote:
>>
>>  Hi All,
>>
>>  I want to change Home link at admin page to Admin Home -> blog -> ...
>>
>>  I tried by modifying  base.html and base_site.html in my 
>> templates/admin/, but it would work
>>
>>  {% block breadcrumbs %}
>> 
>> {% trans ' Admin Home' %}
>> {% if title %} › {{ title }}{% endif %}
>> 
>> {% endblock %}
>>
>>Please help..
>>
>>
>>
>>
>
> Hi Collin,
>
> No changes will be reflected, Please suggest something.
>  
>

-- 
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/834f05aa-4ed5-40e1-b654-788f14319f1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ovreeride django mptt admin queryset

2014-11-21 Thread Collin Anderson
Hi,

Try using get_queryset() instead of queryset().

Collin


On Tuesday, November 18, 2014 8:02:12 AM UTC-5, Neeraj Sharma wrote:
>
> Hi,
>
> I want to override django mptt admin queryset, i want to filter the the 
> queryset.
> I also tried the following method in admin.py  but its not working.
>
>
> def queryset(self, request):
> qs = super(DataField_NEWAdmin, self).queryset(request) 
> return qs.filter(game_event__id=10)
>
> In admin.py when i check queryset then it shows desired queryset but in 
> admin panel/dashboard, it display the all records.
> Please help
>

-- 
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/0e353c7d-d591-4bc6-bfb2-de53eadca026%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using Related Names Not Working

2014-11-21 Thread Collin Anderson
Hi,

Yes, that's what I was hoping. Are you getting an error message, or what 
happens when you try?

Collin


On Tuesday, November 18, 2014 1:16:00 PM UTC-5, Shaun Livingston wrote:
>
> Yeah, I was on the #django IRC yesterday and they were saying something 
> similiar, that I should switch it to a ManyToManyField. I did so, and also 
> tried making it a ForeignKey, but both without success. As far as trying 
> your thought specifically, I changed GenericRelation to ForeignKey and 
> tried it with and without related_name, both without any change in the 
> result. Is this what you intended that I try?
>
>
> On Monday, November 17, 2014 10:50:09 AM UTC-7, Shaun Livingston wrote:
>>
>> Hi, 
>> I have two different apps that contain classes of the same name, and 
>> using a related name in a GenericRelation doesn't seem to be helping. Here 
>> are the details:
>>
>> In both of the apps I have "Source" and "Variable." They're not the same 
>> for either app, so I can't just create one. These apps are called "hs_core" 
>> and "ref_ts." In both apps I have a class called 
>> "Metadata" that has a GenericRelation to both of the 
>> Source and Variable classes. So I added a related_name in order to 
>> differentiate between the two in the database. It didn't seem to have any 
>> effect at all. Here are some snippets of the code (I can add more if you 
>> need):
>>
>> In ref_ts:
>> class Source(AbstractMetaDataElement):
>> term = 'Source'
>> derived_from = models.CharField(max_length=300)
>> organization = models.CharField(max_length=200, null=True)
>> source_description = models.CharField(max_length=400, null=True)
>>
>> def __unicode__(self):
>> return self.derived_from
>>
>> @classmethod
>> def create(cls, **kwargs):
>> if 'derived_from' in kwargs:
>> # check the source doesn't already exists - source needs to 
>> be unique per resource
>> if 'metadata_obj' in kwargs:
>> metadata_obj = kwargs['metadata_obj']
>> metadata_type = 
>> ContentType.objects.get_for_model(metadata_obj)
>> src = Source.objects.filter(derived_from= 
>> kwargs['derived_from'], object_id=metadata_obj.id, 
>> content_type=metadata_type).first()
>> if src:
>> raise ValidationError('Source:%s already exists for 
>> this resource.' % kwargs['derived_from'])
>> src = 
>> Source.objects.create(derived_from=kwargs['derived_from'], 
>> organization=kwargs.get('organization'),source_description=kwargs.get('source_description'),
>>  
>> content_object=metadata_obj)
>> return src
>> else:
>> raise ValidationError('Metadata instance for which source 
>> element to be created is missing.')
>> else:
>> raise ValidationError("Source data is missing.")
>>
>> @classmethod
>> def update(cls, element_id, **kwargs):
>> src = Source.objects.get(id=element_id)
>> if src:
>> if 'derived_from' in kwargs:
>> src.derived_from = kwargs['derived_from']
>> if 'organization' in kwargs:
>> src.organization = kwargs['organization']
>> if 'source_description' in kwargs:
>> src.source_description = kwargs['source_description']
>> src.save()
>> else:
>> raise ObjectDoesNotExist("No source element was found for the 
>> provided id:%s" % element_id)
>>
>> @classmethod
>> def remove(cls, element_id):
>> src = Source.objects.get(id=element_id)
>> if src:
>> src.delete()
>> else:
>> raise ObjectDoesNotExist("No source element was found for 
>> id:%d." % element_id)
>>
>> class RefTSMetadata(CoreMetaData):
>> ...
>> variables = generic.GenericRelation(Ref_TS_Variable, 
>> related_name='ref_ts_variables')
>> sources = generic.GenericRelation(Ref_TS_Source, 
>> related_name='ref_ts_sources')
>> ...
>>
>> @classmethod
>> def get_supported_element_names(cls):
>> # get the names of all core metadata elements
>> elements = super(RefTSMetadata, cls).get_supported_element_names()
>> # add the name of any additional element to the list
>> elements.append('Method')
>> elements.append('QualityControlLevel')
>> elements.append('Variable')
>> elements.append('Site')
>> return elements
>>
>> @property
>> def resource(self):
>> return self._refts_resource.all().first()
>>
>> def get_xml(self):
>> ...
>>
>>

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

Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2014-11-21 Thread donarb
On Friday, November 21, 2014 10:59:19 AM UTC-8, Andreas Ka wrote:
>
> I don't know.
> How to test that?
>
>
>
> The things I have done were these:
>
> https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customizing-your-project-s-templates
>
> mkdir templates
> mkdir templates/admin
> cp 
> /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/base_site.html
>  
> templates/admin/
>
> ls -l templates/admin/base_site.html
> -rw-r--r-- 1 user group 338 Nov 21 18:50 templates/admin/base_site.html
> (and www-data is member of that group)
>
> nano templates/admin/base_site.html   -> changed it to what I want to see
> nano mysite/settings.py  -->   TEMPLATE_DIRS = [os.path.join(BASE_DIR, 
> 'templates')]
>
> restarted the server.
>
>
>
>
>
>
>
> On Fri, Nov 21, 2014 at 3:24 AM, Collin Anderson  > wrote:
>
>> Hi,
>>
>> Do other templates work in that folder?
>>
>> Collin
>>
>>
>> On Monday, November 17, 2014 4:12:27 PM UTC-5, Andreas Ka wrote:
>>
>>>
>>> > Show your view code
>>> The tutorial did not create any view.py for the admin pages
>>>
>>>
>>>
>>> See https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-
>>> the-admin-look-and-feel
>>>
>>> We copied from the Django source files these two into:
>>> /mysite/templates/admin/base_site.html
>>> and
>>> /mysite/templates/admin/index.html
>>>
>>>
>>>
>>> and in https://docs.djangoproject.com/en/1.7/intro/tutorial02/#
>>> customize-the-admin-change-list
>>> edited:
>>>
>>>
>>> admin.py
>>>
>>> from django.contrib import admin
>>>
>>> # Register your models here.
>>>
>>> from django.contrib import admin
>>> from polls.models import Choice, Question
>>>
>>>
>>> class ChoiceInline(admin.TabularInline):
>>> model = Choice
>>> extra = 3
>>>
>>>
>>> class QuestionAdmin(admin.ModelAdmin):
>>> fieldsets = [
>>> (None,   {'fields': ['question_text']}),
>>> ('Date information', {'fields': ['pub_date'], 'classes': 
>>> ['collapse']}),
>>> ]
>>> inlines = [ChoiceInline]
>>> list_display = ('question_text', 'pub_date', 
>>> 'was_published_recently')
>>> list_filter = ['pub_date']
>>> search_fields = ['question_text']
>>>
>>> admin.site.register(Question, QuestionAdmin)
>>>
>>>
>>> ---
>>>
>>>
>>>
>>> On Mon, Nov 17, 2014 at 2:11 PM, Artie  wrote:
>>>
 Are you sure about correct path to your templates in views?

 Show your view code

 понедельник, 17 ноября 2014 г., 5:04:53 UTC+2 пользователь Andreas Ka 
 написал:
>
> thanks for your answer.
>
> yes, I just tried that. Same result.
>
  
>>>
 By now, I have understood much more about the templates.
>
  
>>>
 But still, for the admin pages
> mysite/templates/admin/base_site.html   
> doesn't work yet.
>
>
> ...
>

>>> On Sun, Nov 16, 2014 at 7:19 PM, RLF_UNIQUE  wrote:
>>>
 Obviously you've restarted the server and refreshed the page in such a 
 way to ensure it's not a caching issue ?
>>>
>>>
>>>  
>>>  
>>>
>>  -- 
>> 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/4062bb51-88cd-4c2f-9430-bd6ab87c8902%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
Check your settings file, are there two TEMPLATE_DIRS variables defined? 
Possibly you created one in your edit, but Django already has an empty one 
defined. If your edit was placed before the one that is already defined, it 
would end up empty, hence no override. 

-- 
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/5d66c7ab-92c0-4da7-9346-e25f3b2b8dcd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Want to change home->blog to Admin home -> blog

2014-11-21 Thread donarb
On Friday, November 21, 2014 2:02:29 PM UTC-8, Collin Anderson wrote:
>
> Hi,
>
> Is your TEMPLATE_DIRS set correctly? The tutorial recommends this:
>
> TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
>
> Thanks,
> Collin
>
>
>
> On Tuesday, November 18, 2014 2:06:35 AM UTC-5, Sachin Tiwari wrote:
>>
>>
>>
>> On Thursday, November 13, 2014 7:49:28 PM UTC+5:30, Sachin Tiwari wrote:
>>>
>>>  Hi All,
>>>
>>>  I want to change Home link at admin page to Admin Home -> blog -> ...
>>>
>>>  I tried by modifying  base.html and base_site.html in my 
>>> templates/admin/, but it would work
>>>
>>>  {% block breadcrumbs %}
>>> 
>>> {% trans ' Admin Home' %}
>>> {% if title %} › {{ title }}{% endif %}
>>> 
>>> {% endblock %}
>>>
>>>Please help..
>>>
>>>
>>>
>>>
>>
>> Hi Collin,
>>
>> No changes will be reflected, Please suggest something.
>>  
>>
>

And is there only one TEMPLATE_DIRS variable defined? The settings.py 
template already has one, if the user follows the instructions to *add* 
that line and puts it before the default empty one, it may override and 
wipe out what the user added.

-- 
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/bd08b066-019c-4a97-b6ca-68a57979dda4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Squid or Varnish for Django?

2014-11-21 Thread Collin Anderson
ESI = Edge Side Includes, where some rendering can happen on a CDN.

I personally try to serve the exact same html to every user, and squeeze 
things like "hello so-and-so" (and csrftokens) into a cookie and display 
that using javascript. That way most of my webpages don't have a Vary 
header, and I can take full advantage of http caching.

On Wednesday, November 19, 2014 6:36:14 AM UTC-5, Avraham Serour wrote:
>
> what do you mean by ESI? wikipedia has 7 definitions onlyon computer 
> science
>
> In any case you can build you django application normally and scale in the 
> future as needed.
>
> squid and varnish have different purposes and work on opposites sides of 
> the pipe, varnish sits on the server side serving the html, squid sits on 
> the client side reading, and both of them work with http, doesn't matter if 
> you have django
>
> before you complicate your architecture I suggest you start using the 
> django part of caching, set the http headers for caching
>
> On Wed, Nov 19, 2014 at 1:16 AM, Trupti W 
> > wrote:
>
>> Hi all,
>>
>> I have a django application that needs to be built to scale in the 
>> future. I am considering http caching & ESI for the solution. Has any of 
>> you any experience with either Squid or Varnish? What works better with 
>> Django? I just want the caching & ESI functionality. We are using NGINX as 
>> the reverse proxy.
>>
>> 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-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/fb7e1649-0a3e-4d30-9a3d-ebc582650675%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/fd9961f0-2245-4129-8282-42e23359a8e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Warning / Error when testing with W flag

2014-11-21 Thread Collin Anderson
It looks like it's fixed for python 3.4 on master (the fix will eventually 
be in django 1.8)

On Wednesday, November 19, 2014 10:15:00 AM UTC-5, Carl Meyer wrote:
>
> Hi Daniel, 
>
> On 11/18/2014 02:01 AM, Daniel Grace wrote: 
> > Hi, 
> > I get another warning / error with a test command as follows: 
> >>python -W error manage.py test flow 
> > Traceback (most recent call last): 
> >   File "manage.py", line 8, in  
> > from django.core.management import execute_from_command_line 
> >   File "C:\landy\lib\site-packages\django\core\management\__init__.py", 
> > line 8, 
> > in  
> > from django.apps import apps 
> >   File "C:\landy\lib\site-packages\django\apps\__init__.py", line 1, in 
> >  
> > 
> > from .config import AppConfig   # NOQA 
> >   File "C:\landy\lib\site-packages\django\apps\config.py", line 5, in 
> >  
> > from django.utils.module_loading import module_has_submodule 
> >   File "C:\landy\lib\site-packages\django\utils\module_loading.py", line 
> > 4, in < 
> > module> 
> > import imp 
> >   File "C:\Python34\lib\imp.py", line 32, in  
> > PendingDeprecationWarning) 
> > PendingDeprecationWarning: the imp module is deprecated in favour of 
> > importlib; 
> > see the module's documentation for alternative uses 
>
> This is an issue that needs to be fixed in Django; see 
> https://code.djangoproject.com/ticket/21628 
>
> Until it is fixed in Django, I'm afraid there's not much you can do 
> about it other than ignore these warnings for now. 
>
> Carl 
>
>

-- 
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/47e2cafe-c135-4ab4-9c91-398e781d136a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it wrong to disable a lot of the core django features?

2014-11-21 Thread John Rodkey
Perfect.  That answers my question.  I was trying to avoid having the two 
tables in the db -- but we will just disregard them.

Thank you for all of the input and quick replies.  Django appears to have a 
great community and we are excited to get started.

On Friday, November 21, 2014 3:42:46 PM UTC-6, Carl Meyer wrote:
>
> Hi John, 
>
> On 11/21/2014 02:33 PM, John Rodkey wrote: 
> > Thank you for the quick answer.  Using your recommendation, can we 
> simply 
> > disable the admin, groups and permissions, but still use the 
> Authentication 
> > (login/sessions)?   
>
> The admin is already separate from auth, so that's easy to turn off. 
>
> With the built-in groups and permissions, you will still have tables for 
> them in the database, but they don't need to be linked to your custom 
> User class (as I described in my last mail), so you can basically just 
> ignore them and use your own authorization module instead. 
>
> Carl 
>
>

-- 
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/3bcba735-fa87-477c-8c33-1c7b99718efc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: DecimalField returns 'This value must be a decimal number' when blank

2014-11-21 Thread Collin Anderson
Hi,

Could you post a traceback? Also, what database are you using?

Also also, ModelForms would help simplify your code. Check them out if you 
haven't.
https://docs.djangoproject.com/en/dev/topics/forms/modelforms/

Thanks,
Collin


On Thursday, November 20, 2014 10:44:26 AM UTC-5, elcaiaimar wrote:
>
> I' ve seen that south is for older django versions than 1.7, I continue 
> having the same problem, I wonder if the issue will be in my views, when I 
> save all the information, please, have a look to my code:
>
> if 'formulariopozo' in request.POST:
> formulario = PozosForm(request.POST)
> if formulario.is_valid():
> titulo = 'Formulario de pozos'
>
> codpozo=request.POST['codpozo']
> x=request.POST['coorx']
> y=request.POST['coory']
> tipo=request.POST['tipo']
> cotatrapa=request.POST['cotatrapa']
> profundidad=request.POST['profundidad']
> cotafondo=request.POST['cotafondo']
> material=request.POST['material']
> materialpates=request.POST['materialpates']
> diametro=request.POST['diametro']
> largotrapa=request.POST['largotrapa']
> seccionmayor=request.POST['seccionmayor']
> seccionmenor=request.POST['seccionmenor']
> numacometidas=request.POST['numacometidas']
> origen=request.POST['origen']
> observaciones=request.POST['observaciones']
>
> pnt=Point(float(x),float(y))
> xy=Pozo(codpozo=codpozo, coorx=x, coory=y, tipo=tipo, 
> cotatrapa=cotatrapa,
> profundidad=profundidad, cotafondo=cotafondo, 
> material=material,
> materialpates=materialpates, diametro=diametro, 
> largotrapa=largotrapa,
> seccionmayor=seccionmayor, seccionmenor=seccionmenor, 
> numacometidas=numacometidas,
> origen=origen, observaciones=observaciones, geom=pnt)
> 
> xy.save()
>
> I've tried to put default=None or default=Decimal('0.00') in my models.py 
> but it continues without working. I don't know what can I do
>
> Thank you very much
>
> El domingo, 16 de noviembre de 2014 18:51:43 UTC+1, elcaiaimar escribió:
>>
>> Hello everybody, I've a problem with DecimalField at Forms. I've a long 
>> form in my template and I want to left some fields in blank. I've declared 
>> these fields with 
>> *required=False*, but when I submit the form I receive this error: '*This 
>> value must be a decimal number*'.
>>
>> I've tried to declare *blank=True, null=True* in respective fields in 
>> models.py and make a syncdb but it continues without works
>>
>> Does somebody know how could I solve this problem?
>>
>> 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+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/c1cd4026-a18f-49b6-afaf-200a83602209%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Managing a database connection object in Django

2014-11-21 Thread Collin Anderson
Hi,

For simplicity and reliability, although a hair slower, it probably makes 
sense to create a new database connection during each request.

You could define a function that gets a database connection with your 
parameters and then call that at the top of each view.

Collin

On Thursday, November 20, 2014 1:59:04 PM UTC-5, Ankit Arora wrote:
>
> I'm working with a Postgresql database with Django. Because of licensing 
> reasons, I can't use psycopg2 , so I'm using the alternative pygresql.
>
> I don't need to use the Django ORM at all, I simply need the cursor for 
> cur.execute() and cur.fetchall().
>
> Since pygresql doesn't have a Django backend connector, I can't use the 
> pygresql pgdb module in the Database settings in settings.py; I've to 
> manually open up a connection object.
>
> What would be the best practice to do this? Currently I've simply created 
> the connection object conn=pgdb.connect(params) in views.py outside of 
> all functions, but this seems a bit hacky and I do get 'ProgrammingError: 
> Server Closed the connection unexpectedly' errors here and there.
>
> One approach might be to simply create an executeQuery() function which 
> Opens a connection, executes a query, and closes it each time I want to 
> execute a query. But I'm not sure if that's best practice and whether it 
> would cause any issues.
>
> Any tips?
>

-- 
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/26cf0a67-9eec-479f-9513-fa941e2f3306%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: traceback when encountering unhandled exception and trying to send email

2014-11-21 Thread Collin Anderson
Hi,

Wow. Never seen that one before. I wonder if it's a threading issue / race 
condition.

I looks like there was an error, and then it ran into this error when 
trying to send an email about the original error.

What gunicorn worker type are you using?

You could try asking on the gunicorn list too.

You could try removing/commenting out the LOGGING config as that's mostly 
the defaults anyway.

Collin


On Thursday, November 20, 2014 6:37:53 PM UTC-5, Etienne Le Sueur wrote:
>
> Hi Django users,
>
> has anyone seen a similar traceback to this:
>
> 2014-11-20 14:48:14.190659500 gunicorn[20952]: ERROR: Error handling 
> request
> 2014-11-20 14:48:14.190661500 Traceback (most recent call last):
> 2014-11-20 14:48:14.190661500   File 
> "/build/toolchain/noarch/gunicorn-18.0/lib/python2.7/site-packages/gunicorn/workers/sync.py",
>  
> line 131, in handle_request
> 2014-11-20 14:48:14.190662500 respiter = self.wsgi(environ, 
> resp.start_response)
> 2014-11-20 14:48:14.190662500   File 
> "/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/core/handlers/wsgi.py",
>  
> line 206, in __call__
> 2014-11-20 14:48:14.190674500 response = self.get_response(request)
> 2014-11-20 14:48:14.190674500   File 
> "/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/core/handlers/base.py",
>  
> line 194, in get_response
> 2014-11-20 14:48:14.190675500 response = 
> self.handle_uncaught_exception(request, resolver, sys.exc_info())
> 2014-11-20 14:48:14.190675500   File 
> "/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/core/handlers/base.py",
>  
> line 224, in handle_uncaught_exception
> 2014-11-20 14:48:14.190678500 'request': request
> 2014-11-20 14:48:14.190678500   File 
> "/build/toolchain/lin32/python-2.7.5/lib/python2.7/logging/__init__.py", 
> line 1175, in error
> 2014-11-20 14:48:14.190678500 self._log(ERROR, msg, args, **kwargs)
> 2014-11-20 14:48:14.190679500   File 
> "/build/toolchain/lin32/python-2.7.5/lib/python2.7/logging/__init__.py", 
> line 1268, in _log
> 2014-11-20 14:48:14.190682500 self.handle(record)
> 2014-11-20 14:48:14.190683500   File 
> "/build/toolchain/lin32/python-2.7.5/lib/python2.7/logging/__init__.py", 
> line 1278, in handle
> 2014-11-20 14:48:14.190683500 self.callHandlers(record)
> 2014-11-20 14:48:14.190683500   File 
> "/build/toolchain/lin32/python-2.7.5/lib/python2.7/logging/__init__.py", 
> line 1318, in callHandlers
> 2014-11-20 14:48:14.190684500 hdlr.handle(record)
> 2014-11-20 14:48:14.190686500   File 
> "/build/toolchain/lin32/python-2.7.5/lib/python2.7/logging/__init__.py", 
> line 749, in handle
> 2014-11-20 14:48:14.190686500 self.emit(record)
> 2014-11-20 14:48:14.190686500   File 
> "/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/utils/log.py",
>  
> line 122, in emit
> 2014-11-20 14:48:14.190687500 connection=self.connection())
> 2014-11-20 14:48:14.190687500   File 
> "/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/utils/log.py",
>  
> line 125, in connection
> 2014-11-20 14:48:14.190689500 return 
> get_connection(backend=self.email_backend, fail_silently=True)
> 2014-11-20 14:48:14.190689500   File 
> "/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/core/mail/__init__.py",
>  
> line 29, in get_connection
> 2014-11-20 14:48:14.190690500 klass = import_by_path(backend or 
> settings.EMAIL_BACKEND)
> 2014-11-20 14:48:14.190690500   File 
> "/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/utils/module_loading.py",
>  
> line 21, in import_by_path
> 2014-11-20 14:48:14.190700500 module = import_module(module_path)
> 2014-11-20 14:48:14.190700500   File 
> "/build/toolchain/noarch/django-1.6.5/lib/python2.7/site-packages/django/utils/importlib.py",
>  
> line 41, in import_module
> 2014-11-20 14:48:14.190701500 return sys.modules[name]
> 2014-11-20 14:48:14.190701500 KeyError: 'django.core.mail.backends.smtp'
> 2014-11-20 14:48:14.190861500 gunicorn[20952]: INFO: GET / HTTP/1.0 |  | - 
> | 500 | 0s
>
> Django clear tries to access a module that hasn't been loaded yet.
>
> It is quite possibly a configuration error. Here are some sections from 
> settings.py:
>
>  97 MIDDLEWARE_CLASSES = (
>  98 'django.middleware.common.CommonMiddleware',
>  99 'django.contrib.sessions.middleware.SessionMiddleware',
> 100 'django.middleware.csrf.CsrfViewMiddleware',
> 101 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 102 'django.contrib.messages.middleware.MessageMiddleware',
> 103 )
>
>
> 119 INSTALLED_APPS = (
> 120 'django.contrib.admin',
> 121 'django.contrib.auth',
> 122 'django.contrib.contenttypes',
> 123 'django.contrib.sessions',
> 124 'django.contrib.sites',
> 125 'django.contrib.messages',
> 126 'django.contrib.staticfiles',
> 127 'recommend',
> 128 'tastypie',
> 129 'gunicorn',
> 13

Re: Django comments app - adding each field of comments app to div classes

2014-11-21 Thread Collin Anderson
Hi,

The simple way:

  {{ form }}


The more full way:

 Name
 
 {{ form.user_name.errors }}
 Email
 
 {{ form.user_email.errors }}


Disqus is a good javascript-based comment system that Django also 
recommends.

Collin

On Thursday, November 20, 2014 11:44:12 PM UTC-5, Code wrote:
>
> Also, is there a better alternative to comments app? thanks
>
> On Friday, 21 November 2014 09:10:40 UTC+5:30, Code wrote:
>>
>> I am using django comments app and am using bootstrap template for UI. 
>>
>> In bootstrap I have; 
>>
>> 
>>  Name
>>  > value="" aria-required="true" placeholder="Your Name">
>> 
>>
>>
>> and other div classes to fill in mame , email, url and comments.
>>
>>
>> Django comments app's 
>>
>> {% get_comment_form for post as form %}
>>
>>
>> allows manually render fields like;
>>
>> {{form.user_name}}
>> {{form.user_email}}
>> etc.
>>
>>
>> Question: How do I integrate `{{form.user_name}}` and other fields in the 
>> div class?
>>
>> Thanks for your help.
>>
>

-- 
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/920bafe6-7ebe-42b0-a2c1-5cc8541bd090%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: problem implementing admin inline

2014-11-21 Thread Collin Anderson
Hi,

Here's a hack that might solve your problem.

# moduleApp/admin.py
class ModuleAdmin(admin.ModelAdmin):
inlines = []
# etc

admin.site.register(Module, ModuleAdmin)


# articleApp/admin.py
from moduleApp.admin import ModuleAdmin

class ArticleInline(admin.StackedInline):
model = Article
# etc

ModuleAdmin.inlines.append(ArticleInline)

Collin

On Friday, November 21, 2014 12:22:04 AM UTC-5, yakka...@gmail.com wrote:
>
> I have a  model that has a foreignKey to a  model.  I 
> want to be able to edit the  model within the  admin
>
> in moduleApp.models I have something like:
> class module(models.Model):
>   HTML = models.TextField( blank=True, null=True )
>
> in articleApp.models I have something like:
> class article(models.Model)
>   HomePageModule = models.ForeignKey(module, blank=True, null=True)
>
> In the admin I have something:
> class moduleInline(admin.TabularInline):
> model = module
>
> class ArticleAdmin(admin.ModelAdmin):
> inlines = [moduleInline,]
> 
> I'm getting the error XXX has no ForeignKey to XXX.
>
> I've found a few other people with the problem and it seems like the 
> problem is that I need to change up the moduleInline to articleInline.
>
> http://stackoverflow.com/questions/21899523/inline-in-django-admin-has-no-foreignkey
>
> http://stackoverflow.com/questions/8526159/django-inline-has-no-foreignkey-to
>
> I'm trying to keep my moduleApp as a stand alone app and use it in 
> multiple other apps.  To achieve this I'll have to move all the admin code 
> in the module app.  This defeats my desire to make moduleApp a stand alone 
> app.  
>
> Is there a way I can make inlines work for this?  If not, what is the best 
> way to get this done?  I've got a highly customized admin so I don't mind 
> making the edits.  
>
> Brian
>
>

-- 
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/bb867978-d0fa-4b2d-9e7e-95763b2520ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Has anyone successfully used django-concurrency?

2014-11-21 Thread ian . k
Hey everyone,

One last try. I've given up on django-locking, and am now trying 
django-concurrency because it's more modern and more likely to work on 
Django 1.6.8's admin interface.

The documentation is very basic and doesn't actually give any examples, so 
I'm not sure if I've missed something, but I'm getting this exception when 
I modify my ConfigurationAdmin class to inherit from ConcurrentModelAdmin as 
the documentation discusses. 


class ConfigurationAdmin(ConcurrentModelAdmin):

form = forms.ConfigurationForm
change_list_template = 'admin/configuration/change_list.html'

...



Internal Server Error: /test/common/configuration/
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", 
line 137, in get_response
response = response.render()
  File "/usr/local/lib/python2.7/dist-packages/django/template/response.py", 
line 105, in render
self.content = self.rendered_content
  File "/usr/local/lib/python2.7/dist-packages/django/template/response.py", 
line 82, in rendered_content
content = template.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 
140, in render
return self._render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/test/utils.py", line 85, 
in instrumented_test_render
return self.nodelist.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 
840, in render
bit = self.render_node(node, context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 
78, in render_node
return node.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", 
line 123, in render
return compiled_parent._render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/test/utils.py", line 85, 
in instrumented_test_render
return self.nodelist.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 
840, in render
bit = self.render_node(node, context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 
78, in render_node
return node.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", 
line 123, in render
return compiled_parent._render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/test/utils.py", line 85, 
in instrumented_test_render
return self.nodelist.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 
840, in render
bit = self.render_node(node, context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 
78, in render_node
return node.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", 
line 123, in render
return compiled_parent._render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/test/utils.py", line 85, 
in instrumented_test_render
return self.nodelist.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 
840, in render
bit = self.render_node(node, context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 
78, in render_node
return node.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", 
line 62, in render
result = block.nodelist.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 
840, in render
bit = self.render_node(node, context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 
78, in render_node
return node.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", 
line 62, in render
result = block.nodelist.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 
840, in render
bit = self.render_node(node, context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py", line 
78, in render_node
return node.render(context)
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 
1196, in render
_dict = func(*resolved_args, **resolved_kwargs)
  File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/templatetags/admin_list.py",
 line 288, in result_list
'results': list(results(cl))}
  File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/templatetags/admin_list.py",
 line 266, in results
yield ResultList(None, items_for_result(cl, res, None))
  File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/templatetags/admin_list.py",
 line 258, in __init__
super(ResultList, self).__init__(*items)
  File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/templatetags/admin_list.py",
 line 185, in item

Re: Django 1.7 tutorial: python manage.py migrate errors.

2014-11-21 Thread Collin Anderson
Hi,

I found 
this: http://stackoverflow.com/questions/2384064/python-winreg-problem
So, you could try installing 
win32all http://python.net/crew/skippy/win32/Downloads.html

You don't need to install sqlite3 separately, but there's no command line 
tool out of the box. I've used http://sqliteadmin.orbmu2k.de/ before.

Collin

On Thursday, November 20, 2014 11:05:35 PM UTC-5, Alvin Panugayan wrote:
>
> I'm following the django tutorial online and I'm stuck on the migrate bit 
> (bottom of the post).
>
> 1. Do I need to install south ? Tried to install but am getting a similar 
> error.  OpenKey() argument...
> 2. Do I need to install sqlite3 separately ? Running import sqlite inside 
> the python prompt seems to work, but typing sqlite3 on the windows command 
> prompt doesn't work.
>
> C:\Python33\kaizen>python manage.py migrate
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File "C:\Python33\lib\site-packages\django\core\management\__init__.py", 
> line 385, in execute_from_command_
> utility.execute()
>   File "C:\Python33\lib\site-packages\django\core\management\__init__.py", 
> line 354, in execute
> django.setup()
>   File "C:\Python33\lib\site-packages\django\__init__.py", line 21, in 
> setup
> apps.populate(settings.INSTALLED_APPS)
>   File "C:\Python33\lib\site-packages\django\apps\registry.py", line 108, 
> in populate
> app_config.import_models(all_models)
>   File "C:\Python33\lib\site-packages\django\apps\config.py", line 202, in 
> import_models
> self.models_module = import_module(models_module_name)
>   File "C:\Python33\lib\importlib\__init__.py", line 90, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1584, in _gcd_import
>   File "", line 1565, in _find_and_load
>   File "", line 1532, in 
> _find_and_load_unlocked
>   File "", line 584, in _check_name_wrapper
>   File "", line 1022, in load_module
>   File "", line 1003, in load_module
>   File "", line 560, in 
> module_for_loader_wrapper
>   File "", line 868, in _load_module
>   File "", line 313, in 
> _call_with_frames_removed
>   File "C:\Python33\lib\site-packages\django\contrib\auth\models.py", line 
> 13, in 
> from django.contrib.auth.hashers import (
>   File "C:\Python33\lib\site-packages\django\contrib\auth\hashers.py", 
> line 11, in 
> from django.test.signals import setting_changed
>   File "C:\Python33\lib\site-packages\django\test\__init__.py", line 6, in 
> 
> from django.test.testcases import (
>   File "C:\Python33\lib\site-packages\django\test\testcases.py", line 26, 
> in 
> from django.core.servers.basehttp import WSGIRequestHandler, WSGIServer
>   File "C:\Python33\lib\site-packages\django\core\servers\basehttp.py", 
> line 16, in 
> from wsgiref import simple_server
>   File "C:\Python33\lib\wsgiref\simple_server.py", line 13, in 
> from http.server import BaseHTTPRequestHandler, HTTPServer
>   File "C:\Python33\lib\http\server.py", line 654, in 
> class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
>   File "C:\Python33\lib\http\server.py", line 839, in 
> SimpleHTTPRequestHandler
> mimetypes.init() # try to read system mime.types
>   File "C:\Python33\lib\mimetypes.py", line 348, in init
> db.read_windows_registry()
>   File "C:\Python33\lib\mimetypes.py", line 255, in read_windows_registry
> with _winreg.OpenKey(hkcr, subkeyname) as subkey:
> TypeError: OpenKey() argument 2 must be str without null characters or 
> None, not str
>

-- 
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/e5474eaa-1dcf-45bb-af84-d64b3981f927%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to install psycopg2 using Pip?

2014-11-21 Thread Kat R
This was helpful. Thank you. :)

On Thursday, March 24, 2011 11:49:05 AM UTC-4, Shawn Milochik wrote:
>
> This actually has nothing to do with Python -- I'm talking about your
> PATH, not your PYTHONPATH.
>
> Short version: Type 'which pg_config' at the command line. If it is
> found, then it's on your PATH. Otherwise, it's not, which appears to
> be the case.
>
> If you want to just do a temporary fix, you can follow these steps:
>
> Run this:
> find / -name pg_config 2>>/dev/null
>
> #let's assume the result of the previous command is this:
> /usr/lib/postgresql/8.4/bin/pg_config
>
> Add that path to your PATH temporarily
>
> export PATH=$PATH:/usr/lib/postgresql/8.4/bin
>
> You should then be able to do the pip install.
>
> If that doesn't work because pg_config isn't found on your system at
> all then see Jacob's suggestions.
>
> Shawn
>
>

-- 
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/a663c3ae-5182-4480-b85c-6ab7b73ee38a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Obtaining content from Git

2014-11-21 Thread martin f krafft
Hello,

we have a Django project with a few pages that come from Git.
Currently, Apache rewrite rules serve those files statically (and
they make use of the same template/CSS as Django does, so the user
does not actually notice), and it's a massive hack and pain to keep
up-to-date.

Hence I was thinking: how much trouble would it be to have Django
reach into Git rather than its database and obtain data there to be
filled into template slots? Ideally, there'd be the possibility of
running a filter (e.g. reStructuredText) between Git and the
template rendering.

I've seen http://luispedro.org/software/git-cms, but that does way
more than just sourcing from Git. And it's not immediately obvious
to me how it even does the Git interaction.

What I envision is a storage layer (with optional caching) that
either fetches from the filesystem (with a Git checkout, using mtime
for cache expiration), or directly from a local Git repo (using
either commit or blob hash for cache expiration).

Does anyone know of such a module? Would it be hard to write? Where
would one start?

Thanks,

-- 
@martinkrafft | http://madduck.net/ | http://two.sentenc.es/
 
mulutlitithtrhreeaadededd s siigngnatatuurere
 
spamtraps: madduck.bo...@madduck.net

-- 
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/20141121222930.GA15206%40fishbowl.rw.madduck.net.
For more options, visit https://groups.google.com/d/optout.


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)


Re: Obtaining content from Git

2014-11-21 Thread Aaron C. de Bruyn
I'm not aware of any such module, but there are a few python 'git'
modules for reading/writing, etc...

As for how much trouble it would be, that all depends on how familiar
you are with git, python, Django, and the template system.

One way you might be able to achieve what you want is to create your
own template tag.  (The documentation is here:
https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-tags)

You could pass a few parameters to your tag--I'm not sure what you're
looking for, but maybe:

{% gitfile "myfolder/myfile.txt" "d4ea4eea799" %}

And your tag could load data from "myfolder/myfile.txt" at revision
"d4ea4eea799".

There are a few exampled in the Django code itself
(https://github.com/django/django/tree/master/django/templatetags) as
well as plenty of samples on the internet for writing your own
template tag.

-A

On Fri, Nov 21, 2014 at 2:29 PM, martin f krafft  wrote:
> Hello,
>
> we have a Django project with a few pages that come from Git.
> Currently, Apache rewrite rules serve those files statically (and
> they make use of the same template/CSS as Django does, so the user
> does not actually notice), and it's a massive hack and pain to keep
> up-to-date.
>
> Hence I was thinking: how much trouble would it be to have Django
> reach into Git rather than its database and obtain data there to be
> filled into template slots? Ideally, there'd be the possibility of
> running a filter (e.g. reStructuredText) between Git and the
> template rendering.
>
> I've seen http://luispedro.org/software/git-cms, but that does way
> more than just sourcing from Git. And it's not immediately obvious
> to me how it even does the Git interaction.
>
> What I envision is a storage layer (with optional caching) that
> either fetches from the filesystem (with a Git checkout, using mtime
> for cache expiration), or directly from a local Git repo (using
> either commit or blob hash for cache expiration).
>
> Does anyone know of such a module? Would it be hard to write? Where
> would one start?
>
> Thanks,
>
> --
> @martinkrafft | http://madduck.net/ | http://two.sentenc.es/
>
> mulutlitithtrhreeaadededd s siigngnatatuurere
>
> spamtraps: madduck.bo...@madduck.net
>
> --
> 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/20141121222930.GA15206%40fishbowl.rw.madduck.net.
> 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/CAEE%2BrGqxe5NGvQU6Coam0%2Bev5AjG1GdONt7cdhj9h%2BUshEHSgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.