Linux password authentication for django

2010-12-29 Thread Bill
Hi there,

I want to know is there any authentication module base on Linux passwd/
shadow file for django?

Many thanks,
Bill

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django and eclipse

2010-12-29 Thread girish shabadimath
to change port:
django-admin.py runsserver 

On Thu, Dec 30, 2010 at 6:24 AM, Emmanuel Mayssat wrote:

> For the sqlite.db file issue, I changed the settings.py with:
>
> import os
> PROJECT_DIR = os.path.dirname(__file__)
> ...
> DATABASE_ENGINE = 'sqlite3'
> DATABASE_NAME = os.path.join(PROJECT_DIR, 'sqlite.db')
>
> that now works as expected.
> --
> Emmanuel Mayssat
>
>
>
> On Wed, Dec 29, 2010 at 4:38 PM, Emmanuel Mayssat 
> wrote:
> > I installed the pydev plugin in eclipse.
> > I configured it.
> > Imported my django project and it almost works.
> >
> > Is any one of you using django/eclipse?
> >
> > Well, all goes well until I start the django development server.
> > 1/ how can I change the default port, it is running on ?
> > 2/ My sqlite db files is regenerated by the runserver (I had never
> > seen  that!) in a different directory (at the project level).
> > If I symlink the 2 db files, it works as expected.
> > Any clue?
> >
> > BTW, I noticed that when creating a django project in eclipse, it ask
> > for the path to the db files (when using sqlite3)
> > It is configured to point to the right location, but runserver doesn't
> get that.
> > So what is this db file path used for ? (settings.py is created but
> > not even configured...)
> >
> > --
> > Emmanuel Mayssat
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Girish M S

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: database migration

2010-12-29 Thread Michael P. Soulier
On 29/12/10 Emmanuel Mayssat said:

> I was looking at a possibility of using manage.py dumpscript and
> manage.py runscript
> from django-extensions. But it is not straight forward either.

dumpdata/loaddata is quite simple, I recently used it myself. Torsten
suggested that there's a problem using it with large data sets. I have not
seen this myself.

> Wasn't django supposed to be database agnostic?

Yeah, and ANSI C was supposed to be platform independent. And so was Java. And
Python. And...

> Now, I understand what they really meant.
> Pick you database carefully and stick with it.
> But django code is not database specific.
> ...
> For one second, I though django was the holy grail of all web frameworks
> ...

If anyone claims a holy grail, they are selling you something.

Mike


signature.asc
Description: Digital signature


Re: database migration

2010-12-29 Thread Michael P. Soulier
On 29/12/10 Torsten Bronger said:

> I don't recommend that.  If the database exceeds a certain size (and
> "certain" is MBs, not GBs), this simply fails.

Is there a bug report for this issue? I find that very disappointing.

Mike
-- 
Michael P. Soulier 
"Any intelligent fool can make things bigger and more complex... It takes a
touch of genius - and a lot of courage to move in the opposite direction."
--Albert Einstein


signature.asc
Description: Digital signature


New Django Job Board

2010-12-29 Thread Django Hire
Django Hire (http://www.djangohire.com) was launched today as an
additional alternative to some of the fine options out there.

Employers, help us out by adding your jobs.  You can post free using
code FREEPROMO.

Developers can visit the website or follow us on twitter @djanghire
for listings.

Enjoy!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django and eclipse

2010-12-29 Thread Emmanuel Mayssat
For the sqlite.db file issue, I changed the settings.py with:

import os
PROJECT_DIR = os.path.dirname(__file__)
...
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = os.path.join(PROJECT_DIR, 'sqlite.db')

that now works as expected.
--
Emmanuel Mayssat



On Wed, Dec 29, 2010 at 4:38 PM, Emmanuel Mayssat  wrote:
> I installed the pydev plugin in eclipse.
> I configured it.
> Imported my django project and it almost works.
>
> Is any one of you using django/eclipse?
>
> Well, all goes well until I start the django development server.
> 1/ how can I change the default port, it is running on ?
> 2/ My sqlite db files is regenerated by the runserver (I had never
> seen  that!) in a different directory (at the project level).
> If I symlink the 2 db files, it works as expected.
> Any clue?
>
> BTW, I noticed that when creating a django project in eclipse, it ask
> for the path to the db files (when using sqlite3)
> It is configured to point to the right location, but runserver doesn't get 
> that.
> So what is this db file path used for ? (settings.py is created but
> not even configured...)
>
> --
> Emmanuel Mayssat
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django and eclipse

2010-12-29 Thread Emmanuel Mayssat
I installed the pydev plugin in eclipse.
I configured it.
Imported my django project and it almost works.

Is any one of you using django/eclipse?

Well, all goes well until I start the django development server.
1/ how can I change the default port, it is running on ?
2/ My sqlite db files is regenerated by the runserver (I had never
seen  that!) in a different directory (at the project level).
If I symlink the 2 db files, it works as expected.
Any clue?

BTW, I noticed that when creating a django project in eclipse, it ask
for the path to the db files (when using sqlite3)
It is configured to point to the right location, but runserver doesn't get that.
So what is this db file path used for ? (settings.py is created but
not even configured...)

--
Emmanuel Mayssat

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Question about custom form widgets and validation

2010-12-29 Thread Brandon Taylor
Hi everyone,

I'm working on a custom form widget to input length values in feet,
inches and a fraction of an inch. So far, everything is working as
expected, except for validation.

It takes a value input as:
1' 10 1/2" and converts it into inches: 22.5, for storage in a
database.

My widget combines two text inputs and a select to create the decimal
value. So, I'm using a DecimalField and supplying my widget. However,
if I input a non-numeric value, I'm getting a ValueError in my
value_from_datadict method.

So, obviously I need a try/except in that method, but how do I go
about adding an error message to the field instead of raising a
runtime exception?

Once I get this finished, I'd like to add it to Django Snippets to
share.

Thanks,
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Using session list in a template.

2010-12-29 Thread jacekn
Hello,

I've got following problem that i would ask you to solve:
I want to do collapse/expand part of the web page (show details of the
lectures_list elements/don't show them). I wanted to do this by
creating a session object 'expand_items' that would keep information
which details should be visible. In my view I'm creating a table of
items:

def teaching(request):
  lectures_list = Lecture.objects.all().order_by('short_name')

  if lectures_list.count()>0 and (not ('items_collapse_initialized' in
request.session)):
request.session['items_collapse_initialized'] = True
request.session['expand_items'] = []
for i in range(lectures_list.count()):
  request.session['expand_items'] += '0'

  return render_to_response('main_app/teaching.html',
{'lectures_list' : lectures_list},
context_instance=RequestContext(request))

Element '0' means, that this part won't be visible. In general it
would look something like ['0', '0', '1', '1' ...]. The items will be
changed by the simple post method.

My question is how to generate html template in order to show only
expanded areas. It would be something like:

{% for lecture in lectures_list %}
{% if(request.session.expand_items[foreach.counter]) %}
  show the details

but naturally i can't write expand_items[foreach.counter].

Can you help me how to avoid it? Or maybe there's a better way to do
it?

Best Regards,
Jacek

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



how to view the uploaded files

2010-12-29 Thread rahul jain
How to view the uploaded files on admin ?

Thanks.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ModelForm validation

2010-12-29 Thread Ted
Easiest solution I can see is to create two form classes: StudentForm
and NonStudentForm.  On student form you can then edit form.instance
or form.cleaned_data depending on what your needs are to add the
additional fields before the object is created/updated.

Another approach would be to try setting the fields to "blank = True"
in your model declaration.  I believe this is the exact case for both
a blank=True and a null=True model options.  Blank is for form
validation, Null is for database.

Not a full solution, but perhaps gets you part of the way there.

Ted

On Dec 28, 12:21 pm, Axel Bock  wrote:
> Hi all,
>
> I have this little problem. In my little webapp I have a data model which
> defines several required fields. Depending on WHO is logged on, some of
> these fields should not be changed by the user and be pre-filled (or better:
> post-filled) by the application.
>
> Currently I delete the fields out of the formset like this:
>             # prevent entering missions for all other bases
>             del missionform.fields['base']
>
> so the field gets not rendered in the view. Which works nicely.
>
> Unfortunately base is required, so the validation fails. Now how can I
> insert the missing values into the POST data? I tried this:
>         if request.user.userflag.is_student:
>             logging.error("studen")
>             inst=FlownMission(
>                 student=request.user,
>                 base=request.user.studentinfo.current_base
>             )
>         flownmission = FlownMissionForm(request.POST, instance=inst)
>
> which does not work at all :( . The validation fails all the time ... . I
> just need to inject 2 required values somewhere in the POST data, but I have
> no clue how.
>
> Any help would be greatly appreciated, and I am a total django "newb" ... :)
>
> Thanks & greetings,
> Axel.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



to execute executable.py from view.py

2010-12-29 Thread gintare
I would like by using

#in views.py


def myfnc():
subprocess.Popen( '/polls/executable.py', executable='/usr/lib/
python')



execute  executable.py from views.py function.

I am getting error that terminal is already taken. This is true -
django manage.py runserver keeps django webpages ON.

Is it possible to run paralelly python subprocess.Popen() ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Subdomain/Accounts

2010-12-29 Thread Tim Sawyer

That's a cunning plan, nice one Andy!

I'd use that if I did it again - a virtual host instance per subdomain 
uses lots of memory on a VPS...


Tim.

On 29/12/10 18:19, Andy Shaw wrote:

Tim's solution would obviously work, but it sounds to me like you would
need to manually configure a subdomain (including a copy of settings.py)
for each user. Widoyo's solution (or rather, Ross Poulton's linked
solution) would also work but requires quite a lot of boilerplate code
in your views to retrieve the current username.

I don't know what web server you intend to use, but could you not handle
the problem at this level by using URL rewriting? It shouldn't be hard
to write a rule[1] to map http://myuser.mydomain.com/* to
http://www.mydomain.com/user/myuser/*. Once you've done this, you can
use standard a Django URLConf and not worry about what the actual domain
name is :)

HTH,
-Andy

[1]: There's an example of what is essentially this rule for Apache
here:
http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/



Tim Sawyer 
29 December 2010 17:58


I did this with one settings.py per subdomain, using the sites
framework. So each settings.py had a different SITE_ID.

Here's how to limit admin to a given user's records:

http://drumcoder.co.uk/blog/2010/oct/02/user-specific-data-admin/

This helps with droplists in admin:

http://drumcoder.co.uk/blog/2010/oct/02/limiting-records-django-admin/

The above posts also show how to use a manager to limit the records,
so you can do

Blog.objects.all() to get all records across all sites, and
Blog.on_site.all() to get the records only for the current site.

Hope that helps,

Tim.





Parra 
23 December 2010 04:29


Hello,

I'm new to Django and thinking of using it for a project.

In this project, there will be accounts and each account will have a
subdomain.
Based on the subdomain/account, the user will just see the records
that belongs to them.
The tables will be unique for all accounts, so there should be a field
to identify the account/records

I think this is maybe a common task and that there is a "right" way to
do this...

Can someone give me some tips on where to get started with this ??

Thanks,

Marcello




--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: automatic addition of several ForeignKeys to model

2010-12-29 Thread gintare
Thanks.

The thing which i wanted must be done in forms. It is not for models
and database.

I mean there must be function in views.py which checks if some item
already exists in database and add information about this item
(item.pk) to another synonim item.

On 27 Gruo, 21:15, Emmanuel Mayssat  wrote:
> yes and no ;-)
> I am not sure I understand clearly, but I believe you want to have
> let's say 2 word1 links in word2
> For that you need yo use the related_name as otherwise in word1,
> django tries to create 2 word2 fields (which result in an error)
>
> 149 class Mentorship(models.Model):
> 154     mentee = models.ForeignKey(User, related_name='menteeship_set')
> 155     mentor = models.ForeignKey(User, related_name='mentorship_set')
>
>
>
> On Mon, Dec 27, 2010 at 10:00 AM,gintare wrote:
> > Hello,
>
> > I would like to add ForeignKey which would ass many items to class as
> > much i append-create-give.
>
> > class word1(models.Model):
> >    item=models.CharField(blank=True)
>
> > class word2(models.Model):
> >    itemSynonims=models.ForeignKey(word1)
>
> > i would like to add several word1 to the class word2.
>
> > Is there a way to create a pointer of type ForeignKey(word1), which
> > would
> > let to add many word1, word1, word1 to the same itemSynonims.
>
> > regards
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.- Slėpti cituojamą 
> > tekstą -
>
> - Rodyti cituojamą tekstą -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



custom function for Admin, submit_line.html, views.py

2010-12-29 Thread gintare
1) Where is the *.py file and what is his name, in which there are
written functions related to 'Save and add another', 'Save and
continue editting' buttons of Admin site.
I do not understnad to which file i have to add custom functions for
admin.


2) How to add a button to Admin (i.e. submit_line.html), which
pressing would call function defined in views.py.

I would like to add "custom functions related to button in
submit_line.html"
 in such a way, that i would be able to call from them another custom
functions from views.py

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: merge 2 views?

2010-12-29 Thread Thom van Ledden
Thanks a lot for pointin me in the right direction!

made a context_processor.py for my navigation, and added it to my
settings.py

from basic.blog.models import Category
from common.models import fillNavigationFinishedProjects
from common.models import fillNavigationUnfinishedProjects

def navigation(request):
"""
Adds navigation  variables to the context.

"""
return {
'finishedProjects':fillNavigationFinishedProjects(),
'unfinishedProjects':fillNavigationUnfinishedProjects(),
'blogCategories':Category.objects.all(),
}

Seems to work perfectly!
thanks much!

On 29 dec, 18:51, Michael  wrote:
> Look into context processors, that sounds like what you need.
>
> http://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-c...
> --
> Michael 
>
> On Wed, 2010-12-29 at 08:51 -0800, Thom van Ledden wrote:
> > Hi django developers,
>
> > Ive got a seperate navigation.html file which need to be rendered on
> > each page, but the page need some vars for that. how can i get those
> > vars to be defined just only once?
>
> > my idea: the main_page should add the vars for the navigation, and the
> > views of the content pages will have their own vars, and those need to
> > be merged some how
> > some files i uploaded:http://thomvl.pastebin.com/gGjGj4NP
> >http://thomvl.pastebin.com/uYUp5iCjhttp://thomvl.pastebin.com/Yv6fPTP7
>
> > could anyone point me where i go wrong? (the main_page 's vars are the
> > ones i need, aside of title ofcourse)
>
> > Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Subdomain/Accounts

2010-12-29 Thread Andy Shaw
Tim's solution would obviously work, but it sounds to me like you would 
need to manually configure a subdomain (including a copy of settings.py) 
for each user. Widoyo's solution (or rather, Ross Poulton's linked 
solution) would also work but requires quite a lot of boilerplate code 
in your views to retrieve the current username.


I don't know what web server you intend to use, but could you not handle 
the problem at this level by using URL rewriting? It shouldn't be hard 
to write a rule[1] to map http://myuser.mydomain.com/* to 
http://www.mydomain.com/user/myuser/*. Once you've done this, you can 
use standard a Django URLConf and not worry about what the actual domain 
name is :)


HTH,
-Andy

[1]: There's an example of what is essentially this rule for Apache 
here: 
http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/




Tim Sawyer 
29 December 2010 17:58


I did this with one settings.py per subdomain, using the sites 
framework.  So each settings.py had a different SITE_ID.


Here's how to limit admin to a given user's records:

http://drumcoder.co.uk/blog/2010/oct/02/user-specific-data-admin/

This helps with droplists in admin:

http://drumcoder.co.uk/blog/2010/oct/02/limiting-records-django-admin/

The above posts also show how to use a manager to limit the records, 
so you can do


Blog.objects.all() to get all records across all sites, and
Blog.on_site.all() to get the records only for the current site.

Hope that helps,

Tim.





Parra 
23 December 2010 04:29


Hello,

I'm new to Django and thinking of using it for a project.

In this project, there will be accounts and each account will have a
subdomain.
Based on the subdomain/account, the user will just see the records
that belongs to them.
The tables will be unique for all accounts, so there should be a field
to identify the account/records

I think this is maybe a common task and that there is a "right" way to
do this...

Can someone give me some tips on where to get started with this ??

Thanks,

Marcello




--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

<>

Re: Subdomain/Accounts

2010-12-29 Thread Tim Sawyer
I did this with one settings.py per subdomain, using the sites 
framework.  So each settings.py had a different SITE_ID.


Here's how to limit admin to a given user's records:

http://drumcoder.co.uk/blog/2010/oct/02/user-specific-data-admin/

This helps with droplists in admin:

http://drumcoder.co.uk/blog/2010/oct/02/limiting-records-django-admin/

The above posts also show how to use a manager to limit the records, so 
you can do


Blog.objects.all() to get all records across all sites, and
Blog.on_site.all() to get the records only for the current site.

Hope that helps,

Tim.

On 23/12/10 04:29, Parra wrote:

Hello,

I'm new to Django and thinking of using it for a project.

In this project, there will be accounts and each account will have a
subdomain.
Based on the subdomain/account, the user will just see the records
that belongs to them.
The tables will be unique for all accounts, so there should be a field
to identify the account/records

I think this is maybe a common task and that there is a "right" way to
do this...

Can someone give me some tips on where to get started with this ??

Thanks,

Marcello



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: merge 2 views?

2010-12-29 Thread Michael
Look into context processors, that sounds like what you need.

http://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-context-requestcontext
-- 
Michael 

On Wed, 2010-12-29 at 08:51 -0800, Thom van Ledden wrote:
> Hi django developers,
> 
> Ive got a seperate navigation.html file which need to be rendered on
> each page, but the page need some vars for that. how can i get those
> vars to be defined just only once?
> 
> my idea: the main_page should add the vars for the navigation, and the
> views of the content pages will have their own vars, and those need to
> be merged some how
> some files i uploaded: http://thomvl.pastebin.com/gGjGj4NP
> http://thomvl.pastebin.com/uYUp5iCj http://thomvl.pastebin.com/Yv6fPTP7
> 
> could anyone point me where i go wrong? (the main_page 's vars are the
> ones i need, aside of title ofcourse)
> 
> Thanks in advance
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Date Error in Admin Form

2010-12-29 Thread ckar...@googlemail.com
Thanks, but

USE_I18N = True
USE_L10N = True

in settings.py resolved my problem :-)

On 29 Dez., 18:03, Marcos Moyano  wrote:
> Take a look at the docs on how to set up valid input formats
>
> http://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs#date-...
>
> Rgds,
> Marcos
>
> On Wed, Dec 29, 2010 at 1:39 PM, ckar...@googlemail.com <
>
>
>
> ckar...@googlemail.com> wrote:
> > Hi everybody,
>
> > I'm getting a strange error with a datefield in the django admin.
>
> > My Settings:
> > · TIME_ZONE = 'Europe/Berlin'
> > · LANGUAGE_CODE = 'de-DE'
> > · USE_I18N = True
>
> > The according models.py entry:
> > zeithorizont = models.DateField(blank=True, null=True)
>
> > Screenshot (german):http://static.karrie.info/djangoformerror.png
>
> > I can't figure it out...
>
> > Thank you,
> > Christian
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Some people, when confronted with a problem, think “I know, I'll use regular
> expressions.” Now they have two problems.
>
> Jamie Zawinski, in comp.emacs.xemacs

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Date Error in Admin Form

2010-12-29 Thread Marcos Moyano
Take a look at the docs on how to set up valid input formats

http://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs#date-format

Rgds,
Marcos

On Wed, Dec 29, 2010 at 1:39 PM, ckar...@googlemail.com <
ckar...@googlemail.com> wrote:

> Hi everybody,
>
> I'm getting a strange error with a datefield in the django admin.
>
> My Settings:
> · TIME_ZONE = 'Europe/Berlin'
> · LANGUAGE_CODE = 'de-DE'
> · USE_I18N = True
>
> The according models.py entry:
> zeithorizont = models.DateField(blank=True, null=True)
>
> Screenshot (german): http://static.karrie.info/djangoformerror.png
>
> I can't figure it out...
>
> Thank you,
> Christian
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Some people, when confronted with a problem, think “I know, I'll use regular
expressions.” Now they have two problems.

Jamie Zawinski, in comp.emacs.xemacs

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



merge 2 views?

2010-12-29 Thread Thom van Ledden
Hi django developers,

Ive got a seperate navigation.html file which need to be rendered on
each page, but the page need some vars for that. how can i get those
vars to be defined just only once?

my idea: the main_page should add the vars for the navigation, and the
views of the content pages will have their own vars, and those need to
be merged some how
some files i uploaded: http://thomvl.pastebin.com/gGjGj4NP
http://thomvl.pastebin.com/uYUp5iCj http://thomvl.pastebin.com/Yv6fPTP7

could anyone point me where i go wrong? (the main_page 's vars are the
ones i need, aside of title ofcourse)

Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Date Error in Admin Form

2010-12-29 Thread ckar...@googlemail.com
Hi everybody,

I'm getting a strange error with a datefield in the django admin.

My Settings:
· TIME_ZONE = 'Europe/Berlin'
· LANGUAGE_CODE = 'de-DE'
· USE_I18N = True

The according models.py entry:
zeithorizont = models.DateField(blank=True, null=True)

Screenshot (german): http://static.karrie.info/djangoformerror.png

I can't figure it out...

Thank you,
Christian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how can i define a decimal_separator and a thousand_separator

2010-12-29 Thread Sergio Berlotto Jr
Use the DECIMAL_SEPARATOR, THOUSAND_SEPARATOR and NUMBER_GROUPING settings.
See: http://docs.djangoproject.com/en/1.2/ref/settings/ 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django project like ycombinator

2010-12-29 Thread xjdrew
hi, all
I plan to develop a news aggregate websites (main in education field),
where people can post and discuss news free. The style of hacker news
is extremely similar with my plan.
I try to find some similar django project, but I failed. Maybe you
guys have some fantastic advice here. I'm trouble to ask, is there any
django project like hacker news(http://news.ycombinator.com/).

best regards,
drew

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



string format date in query

2010-12-29 Thread Nick
I am using a little raw SQL to pull out a count of events by month. I
am able to retrieve the correct information but am getting the month
value in numerical form rather than an actual name. So instead of
January I get a 1.

Here is query:
dates = markers.extra(select={'month':
'month(date)'}).values('month').order_by('month').annotate(month_count=Count('id'))



originally I had something like this:

dates = markers.extra(select={'month':"strftime('%F',
'month(date)')"}).values('month').order_by('month').annotate(month_count=Count('id'))

but that was returning 0 results

any help would be much appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ModelForm validation

2010-12-29 Thread Axel Bock
hi derek,

thanks for your hints - was I really that unclear? hm.

anyway, could you please give an example about how to "override/check the
value for that field after the form POST"? I don't seem to be able to do
that, and believe me, I have read the docs.

I think cleaned_data is only available after is_valid() was called, but
is_valid() throws an exception because the required field is missing - and I
can't set it.

The hidden field thing is the last thing I wanted to try. bad style, you
know :) , cause security risk.


thanks!
Axel.



2010/12/29 derek 

> Axel
>
> Not sure I have followed all your requirements, but perhaps you can
> try:
> * set a default value for the required field
> * mask the required field on the form being shown to the user (make it
> hidden)
> * override/check the value for that field after the form POST and data
> "clean" (see:
> http://docs.djangoproject.com/en/dev/topics/forms/?from=olddocs#processing-the-data-from-a-form
> )
>
> HTH
> Derek
>
> On Dec 28, 10:21 pm, Axel Bock  wrote:
> > Hi all,
> >
> > I have this little problem. In my little webapp I have a data model which
> > defines several required fields. Depending on WHO is logged on, some of
> > these fields should not be changed by the user and be pre-filled (or
> better:
> > post-filled) by the application.
> >
> > Currently I delete the fields out of the formset like this:
> > # prevent entering missions for all other bases
> > del missionform.fields['base']
> >
> > so the field gets not rendered in the view. Which works nicely.
> >
> > Unfortunately base is required, so the validation fails. Now how can I
> > insert the missing values into the POST data? I tried this:
> > if request.user.userflag.is_student:
> > logging.error("studen")
> > inst=FlownMission(
> > student=request.user,
> > base=request.user.studentinfo.current_base
> > )
> > flownmission = FlownMissionForm(request.POST, instance=inst)
> >
> > which does not work at all :( . The validation fails all the time ... . I
> > just need to inject 2 required values somewhere in the POST data, but I
> have
> > no clue how.
> >
> > Any help would be greatly appreciated, and I am a total django "newb" ...
> :)
> >
> > Thanks & greetings,
> > Axel.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how can i define a decimal_separator and a thousand_separator

2010-12-29 Thread refreegrata
I still have the doubt.Does anyone know?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ModelForm validation

2010-12-29 Thread derek
Axel

Not sure I have followed all your requirements, but perhaps you can
try:
* set a default value for the required field
* mask the required field on the form being shown to the user (make it
hidden)
* override/check the value for that field after the form POST and data
"clean" (see: 
http://docs.djangoproject.com/en/dev/topics/forms/?from=olddocs#processing-the-data-from-a-form)

HTH
Derek

On Dec 28, 10:21 pm, Axel Bock  wrote:
> Hi all,
>
> I have this little problem. In my little webapp I have a data model which
> defines several required fields. Depending on WHO is logged on, some of
> these fields should not be changed by the user and be pre-filled (or better:
> post-filled) by the application.
>
> Currently I delete the fields out of the formset like this:
>             # prevent entering missions for all other bases
>             del missionform.fields['base']
>
> so the field gets not rendered in the view. Which works nicely.
>
> Unfortunately base is required, so the validation fails. Now how can I
> insert the missing values into the POST data? I tried this:
>         if request.user.userflag.is_student:
>             logging.error("studen")
>             inst=FlownMission(
>                 student=request.user,
>                 base=request.user.studentinfo.current_base
>             )
>         flownmission = FlownMissionForm(request.POST, instance=inst)
>
> which does not work at all :( . The validation fails all the time ... . I
> just need to inject 2 required values somewhere in the POST data, but I have
> no clue how.
>
> Any help would be greatly appreciated, and I am a total django "newb" ... :)
>
> Thanks & greetings,
> Axel.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Looking for a business directory app

2010-12-29 Thread uwtguy
I have a website that survived several platform changes, and it is now
a number of independent platforms slapped together (Joomla, vBulletin
board etc.). I want to gradually rebuild it into a single system using
Django. Right now I am looking for a business directory Django
application to replace the Mosets MTree directory I have installed. I
have searched the Internet, but there is nothing I can find. I don't
want to reinvent the bicycle and write it all myself. Does anyone know
of such an app?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Generate template files, lazy-loading

2010-12-29 Thread Guax3
I wasn't aware of the whole django's cache framework.
Again, i'm a noob...
Thank you very much for pointing me in the right direction, I'll try
your recomendations :)

On 28 dez, 03:41, Mayuresh Phadke  wrote:
> You could cache the output, some thing like:
>
> def generate_questionnaire_view():
>        if is_cached_output_available():
>               return get_cached_oputput()
>        else:
>               output_html = render_to_string(your parameters)
>               add_to_cache(output_html)
>               return output_html
>
> The is_cached_output_available() function will check if we have some output
> cached, and nothing has changed since we cached the output.
>
> Regards,
> Mayuresh
>
> http://twitter.com/geeroohttp://twitter.com/django_updates
>
> On Monday, December 27, 2010 8:08:40 PM UTC+5:30, Guax3 wrote:
>
> > I have a template in where I load a set of questions for a a
> > questionnaire, and each question has a set of options all this
> > information is retrieved from a database. so there's one for to
> > questions and another for to options, that gives:
>
> >  {% for question in questionnaire %}
> >     {{forloop.counter}}. {{ question }} > td>
> >     
> >     {% for alternative in question.get_alternatives %}
> >          > value="{{alternative.id}}"> {{ alternative }}
> >     {% endfor %}
> >     
> > {% endfor %}
>
> > The problem: depending on the number of questions, it can get pretty
> > heavy and time-consuming to retrieve all questionnaire from the
> > database.
>
> > My raw solution was to copy the output html code of all questionnaires
> > and save it on another "static" template,
> > I'm aware of the non-practicality of such so, here's my question:
>
> > Is there any pythonic-djangonic way to, in a lazy-loading style,
> > generate a template file where all the database retrieving was already
> > done and the whole html code was made, only regenerating this file if
> > something was changed in the database?
>
> > Did I made this question understandable? (I'm sorry, I'm a noob)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Massive insertion of records

2010-12-29 Thread Derek
Thanks Craig - that explains it very clearly indeed ("textbook answer"!)

On 27 December 2010 16:50, W. Craig Trader  wrote:

> Derek ...
>
> Quoting from http://docs.djangoproject.com/en/1.2/topics/db/transactions/:
>
>> Django’s default behavior is to run with an open transaction which it
>> commits automatically when any built-in, data-altering model function is
>> called. For example, if you call model.save() or model.delete(), the
>> change will be committed immediately.
>>
>> This is much like the auto-commit setting for most databases. As soon as
>> you perform an action that needs to write to the database, Django produces
>> the INSERT/UPDATE/DELETE statements and then does the COMMIT. There’s no
>> implicit ROLLBACK.
>>
>
> Using the Django transaction API, you can manually control transactions.
> In this case, Silva must be doing something like this:
>
> from django.db import transaction
>
> @transaction.commit_manually
> def viewfunc(request):
>
>
> ...
> # You can commit/rollback however and whenever you want
> i = 0
> for x in data:
> ... save something ...
> i += 1
> if i % 1000:
>
> transaction.commit()
>
> # One last commit to persist the last batch of saves
> transaction.commit()
>
>
> I will also note that the transaction API can be (and should be) used when
> you're writing management commands.
>
>  - Craig -
>
> On Mon, Dec 27, 2010 at 05:29, derek  wrote:
>
>> Can you explain what you mean by "manual commitments" (preferably with
>> a code example)?
>>
>> Thanks
>> Derek
>>
>> On Dec 26, 4:38 am, Silva Paulo  wrote:
>> > OK. I found a "solution".
>> > Using manual commitments after lots of insertions (ex. >1000) makes the
>> massive insertion very fast (at least for my needs).
>> >
>> > Thanks to all who answered.
>> >
>> > --- On Fri, 12/24/10, Silva Paulo  wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > From: Silva Paulo 
>> > > Subject: Massive insertion of records
>> > > To: "newbie" 
>> > > Date: Friday, December 24, 2010, 6:26 PM
>> > > I need to do a massive insertion of
>> > > records in two tables "connectd" by "foreignkey". Is there a
>> > > way, using the Django db API, to do it. e=Foo(...);e.save()
>> > > seems too slow.
>> >
>> > > Thanks
>> >
>> > >
>> >
>> > > --
>> > > You received this message because you are subscribed to the
>> > > Google Groups "Django users" group.
>> > > To post to this group, send email to django-us...@googlegroups.com.
>> > > To unsubscribe from this group, send email to
>> > > django-users+unsubscr...@googlegroups.com
>> .
>> > > For more options, visit this group athttp://
>> groups.google.com/group/django-users?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Using gunicorn for deployment, code reloading problem

2010-12-29 Thread Metin Amiroff
Hello everyone!

I'm trying to use gunicorn for Django application deployment and
running into issue with code reloading. It looks like using than 2
workers (on my dual core cpu/dev machine) modifications in app code
get noticed, but in incredibly unstable way: I see different version
of code on each page reload.

Now, gunicorn docs do mention a way(1) to reload application by
issuing a kill -HUP command; and while that works perfectly, I would
really like to know why my code reloads with more workers as I'm eager
to use more of those on production server's stronger CPU. Here's the
command I'm testing it with:

./myapp/manage.py run_gunicorn --log-file=/home/dev/Desktop/
gunicorn.log --bind=127.0.0.1:9000 --pid=/home/dev/Desktop/
gunicorn.pid --workers=3

With --workers=2 I'm having absolutely no problems.

Thanks, and happy new year!

[1] http://gunicorn.org/faq.html#contents

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Splitting the models.py file

2010-12-29 Thread Łukasz Rekucki
On 29 December 2010 10:37, Emmanuel Mayssat  wrote:
> I attempted to split the model file into a 'module' (subdir with __init__.py).
> But for some reason syncdb doesn't see my app anymore.

Every python file is a "module". A directory with __init__ is a
"package". Now you can google for "django models package":

http://www.acooke.org/cute/UsingaDire0.html

-- 
Łukasz Rekucki

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Splitting the models.py file

2010-12-29 Thread Emmanuel Mayssat
I attempted to split the model file into a 'module' (subdir with __init__.py).
But for some reason syncdb doesn't see my app anymore.

Did anyone of you manage to split the models.py file into several smaller ones?
--
E

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: database migration

2010-12-29 Thread Emmanuel Mayssat
Michael, that's encouraging ;-)
I was looking at a possibility of using manage.py dumpscript and
manage.py runscript
from django-extensions. But it is not straight forward either.

Wasn't django supposed to be database agnostic?
Now, I understand what they really meant.
Pick you database carefully and stick with it.
But django code is not database specific.
...
For one second, I though django was the holy grail of all web frameworks
...

--
E

On Tue, Dec 28, 2010 at 11:48 PM, Torsten Bronger
 wrote:
> Hallöchen!
>
> Michael P. Soulier writes:
>
>> On 28/12/10 Emmanuel Mayssat said:
>>
>>> I have a classic database dump question
>>>
>>> I would like to migrate from sqlite to mysql.
>>> How can I dump and import the data?
>>
>> See the manage.py dumpdata/loaddata commands.
>
> I don't recommend that.  If the database exceeds a certain size (and
> "certain" is MBs, not GBs), this simply fails.
>
> Tschö,
> Torsten.
>
> --
> Torsten Bronger, aquisgrana, europa vetus
>                   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
>                                  or http://bronger-jmp.appspot.com
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.