Re: Server error caused by too many database look-ups

2012-05-02 Thread koenb
You should use DEBUG=True in your development settings, so you get a proper 
traceback of what is going on. 

As far as I can see, you do have syntax errors in your models.py file (eg 
line 266). You should fix them first.

As a side note, your unicode methods are not all correct, some of them are 
returning bytestrings (this may bite you once you start using non-ascii 
data).

Koen

Op woensdag 2 mei 2012 21:37:30 UTC+2 schreef Jonas Ghyllebert het volgende:
>
> Hi everybody,
>
> I've got a problem while accessing a model in the Django Adminpanel.
> I uploaded the models file, i hope this makes it easier for you to 
> understand my problem.
>
> When I try to add or view a *Region *in the adminpanel, the server 
> usually gives me an 500 server error.
> This is what i get to see:
>  
> Error: Server ErrorThe server encountered an error and could not complete 
> your request.
>
> If the problem persists, please 
> report your 
> problem and mention this error message and the query that caused it.
>
> Now, in the uploaded file you may (or not) have seen that I want to have 
> 25 fields from Zip.
>
> My guess is that Django connects to the database for every listbox it is 
> generating.
> Is there a way to cache the 2000+ zips?
> Or, am I seeing it wrong? What should I do then?
>
> Greetings
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/-6OzpusVZSMJ.
To post to this group, send email to django-users@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: Dojo Rich Editor Implementation in Admin.py

2012-05-02 Thread Gchorn
So after doing some more research and playing around with the settings, I 
want to post an updated version of my question.  Here it is.

I'm building a blog, with models "Post" and "Image" like so:

class Post(models.Model):
title = models.CharField(max_length=1000)
author = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
text = models.TextField(max_length=1)

class Image(models.Model):
post = models.ForeignKey(Post, related_name='images')
image = models.ImageField(upload_to='photos/%Y/%m/%d')
caption = models.CharField(max_length=1000,blank=True)

I've been trying to implement the Dojo rich editor in my admin site by 
following the example here:

http://lazutkin.com/blog/2011/mar/13/using-dojo-rich-editor-djangos-admin/

However, there's some kind of interference between settings in my admin.py 
file that is keeping me from registering both the rich editor and a 
ModelAdmin class for uploading images associated with an instance of 
"Post." If I use the following code in my admin.py file:

from django.contrib.admin import site, ModelAdmin
import models

class CommonMedia:
js = (
  'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js',
  'editor.js',
)
css = {
  'all': ('editor.css',),
}

site.register(models.Post,
Media = CommonMedia,
)

The rich text editor shows up fine. But if I add some code for image 
uploading fields, like so:

from blogs.models import Post,Image
from django.contrib import admin
from django.contrib.admin import site, ModelAdmin
import models


class CommonMedia:
  js = (
'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js',
'editor.js',
  )
  css = {
'all': ('editor.css',),
  }

class PostImageInline(admin.TabularInline):
model = Image
extra = 5

class PostAdmin(admin.ModelAdmin):
inlines = [PostImageInline]

site.register(models.Post,
list_display = ('text',),
search_fields = ['text',],
Media = CommonMedia,
)

admin.site.unregister(Post)

admin.site.register(Post, PostAdmin)

the rich editor doesn't show up. I'm guessing this is due to the 
"admin.site.unregister(Post)" line, but if I don't use that I get the 
error, "The model Post is already registered." If instead I remove both 
that line and the "Post" from "admin.site.register(Post, PostAdmin)", I get 
the error: "'MediaDefiningClass' object is not iterable".  I know I must be 
going about registering my ModelAdmin and the rich editor incorrectly, but 
I can't seem to find any documentation online about "admin.site.register" 
and "site.register," so I'm totally stuck.  Any help on this would be much 
appreciated!

cheers,

Guillaume

On Tuesday, May 1, 2012 1:34:31 PM UTC+8, Gchorn wrote:
>
> Hi All,
>
> I'm building a blog, with models "Post" and "Image" (each blog post can 
> have multiple images; they're related by ForeignKey) and I'm trying to 
> implement the Dojo rich editor in my admin site by following the example 
> here: 
>
> https://gist.github.com/868595
>
> However, the rich editor is not showing up.  I have a feeling I don't have 
> something set up correctly in my admin.py file; could anyone tell me what 
> it is?  Here are the contents of admin.py:
>
> from blogs.models import Post,Image
> from django.contrib import admin
> from django.contrib.admin import site, ModelAdmin
> import models
>
>
> class CommonMedia:
>   js = (
> 'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js',
> '/home/guillaume/mysite/blogs/static/editor.js',
>   )
>   css = {
> 'all': ('/home/guillaume/mysite/blogs/static/editor.css',),
>   }
>
> class PostImageInline(admin.TabularInline):
> model = Image
> extra = 5
>
> class PostAdmin(admin.ModelAdmin):
> inlines = [PostImageInline]
>
> site.register(models.Post,
> list_display = ('text',),
> search_fields = ['text',],
> Media = CommonMedia,
> )
>
> admin.site.unregister(Post)
>
> admin.site.register(Post, PostAdmin)
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/DbT0JenkPsYJ.
To post to this group, send email to django-users@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's DecimalField represenation in admin as 0,00 values

2012-05-02 Thread jrief
Internally a price is always handled and stored as 0.00. Thats the way 
software and databases work.

What you can do is to change the representation of your Decimal in your 
frontend and backend. In Django, changing this in the frontend its easy, 
just add USE_L10N = True to your settings.py and add localized=True to all 
occurrences of form fields handling a Decimal (see 
https://docs.djangoproject.com/en/1.4/ref/forms/fields/#localize)

The problem is the backend, because you are not specifying these form 
field. What I do is to add a mixin class to my admin classes, as described 
here: https://github.com/divio/django-shop/pull/146#issuecomment-4720340 
and 
here https://github.com/divio/django-shop/blob/master/shop/admin/mixins.py

For your "2.1" problem, set decimal_places to 2 DecimalField.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/3W6XMRFdBFUJ.
To post to this group, send email to django-users@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's DecimalField represenation in admin as 0,00 values

2012-05-02 Thread Mike Dewhirst

On 3/05/2012 2:30pm, orschiro wrote:

Anybody?

On May 2, 11:07 am, orschiro  wrote:

I want to represent a price in my model in the form of 0,00. This is
the part of my model.

price = models.DecimalField(max_digits=5, decimal_places=2,
default=Decimal('0.00'))

However, prices such as 2.10 are still represented as 2.1.

The second issue would be to replace the . with a ,. However
default=Decimal('0,00') of course is not possible since , is not a
valid literal for Decimal.

Any ideas?


Never tried this but I certainly want to eventually. So in settings.py 
at the least you would need ...


# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

https://docs.djangoproject.com/en/1.4/topics/i18n/

If you figure out the neatest way for different users in different 
places to switch locales I would like to hear how it is done.


Cheers

Mike





--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@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's DecimalField represenation in admin as 0,00 values

2012-05-02 Thread orschiro
Anybody?

On May 2, 11:07 am, orschiro  wrote:
> I want to represent a price in my model in the form of 0,00. This is
> the part of my model.
>
> price = models.DecimalField(max_digits=5, decimal_places=2,
> default=Decimal('0.00'))
>
> However, prices such as 2.10 are still represented as 2.1.
>
> The second issue would be to replace the . with a ,. However
> default=Decimal('0,00') of course is not possible since , is not a
> valid literal for Decimal.
>
> Any ideas?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: [Deploy] - Missing css, js ...

2012-05-02 Thread MN TS
Ok thanks your reply.
So what should i do now ?.
I'm using bluehost.com.






On Wed, May 2, 2012 at 10:09 PM, Marcin Tustin wrote:

> This is not a django question. It relates to your deployment setup. Ask at
> the forums for your host. In addition, this does not contain anything like
> the detail that anyone anywhere would need to answer.
>
> On Wed, May 2, 2012 at 3:06 PM, MN TS  wrote:
>
>>   Hello Comrades ,
>>
>> I'm starting with Django and I have a bluehost,
>> My problem is that : i missed css , js (media)
>>
>> I create symbol link but its not working.
>>
>> ln -s /home5/user/public_html/MyProject/src/app/static/ static
>>
>> Do you know why is happen
>> this to me?
>>
>> Regards
>> Tsolmon.
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@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.
>>
>
>
>
> --
> Marcin Tustin
> Tel: 07773 787 105
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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-users@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: Need help

2012-05-02 Thread Peter of the Norse
There is a difference between 'localhost' and the empty string. 'localhost' 
translates into 127.0.0.1 and is sent using the internet. The empty string 
means to use local sockets for communication. At least with PostgreSQL. (It 
might be different with MySQL.) 

In short, this is not a bug. Please don't treat it as such, and learn the 
connection settings of your database.

On Apr 3, 2012, at 11:16 AM, Andre Terra wrote:

> It could be a regression bug.
> 
> To be honest, I don't see a reason why '' should become 'localhost' 
> automagically. I'd much prefer if users were forced to write 'localhost' 
> rather than having Django do it (and fail) for them.
> 
> Explicit is better than implicit.
> 
> If you haven't yet, please file a bug report: 
> https://code.djangoproject.com/newticket
> 
> 
> Cheers,
> AT
> 
> 
> On Tue, Apr 3, 2012 at 12:25 PM, thongor  wrote:
> Wow this post is really old but this also solved my problem strangely enough. 
> 
> On Thursday, June 25, 2009 2:48:32 PM UTC-4, amy wrote:
> I had this same problem...the user and pass were fine but no users 
> could authenticate on any DB, regardless of settings. 
> 
> Turns out my issue was only that I needed to add the string 
> "localhost" to the host parameter. 
> 
> It's odd since the comments specifically state to leave it blank for 
> localhost...but oh well. It worked. 
> 
> DATABASE_HOST = 'localhost' # Set to empty string for 
> localhost. Not used with sqlite3. 
> 
> Odd. 
> 
> On May 31, 6:14 am, Tim Chase  wrote: 
> > mizan rahman wrote: 
> > > No, i've checked that i've created a user named "djangouser" and the 
> > > problem still exist what will i do? Plz help me 
> > 
> > and you've checked that the password in settings.py is correct? 
> > You only confirmed one of the two problems I suggested. 
> > 
> > If both are correct, you may have to include the section of your 
> > pg_hba.conf that defines access permissions.  It usually looks 
> > something like 
> > 
> > ## 
> > local   all postgres  ident sameuser 
> > 
> > # TYPE  DATABASEUSERCIDR-ADDRESS  METHOD 
> > 
> > # "local" is for Unix domain socket connections only 
> > local   all all   ident sameuser 
> > # IPv4 local connections: 
> > hostall all 127.0.0.1/32  md5 
> > # IPv6 local connections: 
> > hostall all ::1/128   md5 
> > ## 
> > 
> > along with information about how your connecting in Django (to 
> > localhost, to the local machine by IP address, to a remote 
> > machine, etc) 
> > 
> > -tkc 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/BI0mwz_xsrsJ.
> To post to this group, send email to django-users@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-users@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.

Peter of the Norse
rahmc...@radio1190.org



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: hop by hop errors..

2012-05-02 Thread hanj99
I found the solution.

hop_headers are renamed to hoppish in Django 1.4

And the location of codes are not in the django directory.

It is in the /XXX/python2.6/wsgiref/util.py

And I deleted the related keys from the dictionary.

_hoppish = {
'proxy-authenticate':1, 'proxy-authorization':1, 'te':1,
'trailers':1, 'upgrade':1
}.__contains__


On 5월2일, 오후11시16분, hanj99  wrote:
> Hi~~
> I'm using Django 1.4. to implement RESTful service. And for a
> compatibility test with S3 Amazon API, I'm using a s3browser.( which
> is famous among amazon storage users)
>
> But, I have a problem when I try to do the following.
>
> response = HttpResponse()
> response['transfer-encoding'] = 'chunked'
>
> The error is 'hop-by-hop header is not allowed'
>
> When I used Django 1.3, the problem could be solved by
>
> del hop_headers['transfer-encoding']
>
> But, after I upgraded Django to 1.4, I can't find any
> hop header related codes anywhere :(
>
> Please let me know where in the codes I should look into..
>
> Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Good method to require EULA acceptance

2012-05-02 Thread Nikolas Stevenson-Molnar
Expanding on Jonathan's suggestion, you could create a simple middleware
function to redirect a user to the EULA page if they haven't accepted it
yet. And you don't need to put the restriction into every view: it's
automatic.

https://docs.djangoproject.com/en/dev/topics/http/middleware/?from=olddocs

_Nik

On 5/2/2012 3:00 PM, BGMaster wrote:
> That's what I have. The problem is that you then have to restrict
> access on every page of your site to those who've accepted the EULA.
> What I would rather do is create a profile and only allow access to
> the EULA acceptance page once the person is registered and until they
> accept the EULA. I'm just having a hard time conceptualizing a way to
> do this code-wise.
>
> On May 2, 5:41 pm, "Jonathan D. Baker" 
> wrote:
>> You could store the Eula as a boolean field on a user profile model and 
>> manage it that way.
>>
>> Sent from my iPhone
>>
>> On May 2, 2012, at 3:34 PM, BGMaster  wrote:
>>
>>
>>
>>
>>
>>
>>
>>> Hi,
>>> I'm trying to implement acceptance of a EULA into my site registration
>>> form. The EULA acceptance is on a separate page from the rest of the
>>> registration form. I'm trying to figure out a way to prevent the user
>>> from accessing the rest of the site without accepting the EULA. Every
>>> path I go down seems to end up being very hackish. Has anyone done a
>>> EULA in a separate view/page from the rest of the site registration?
>>> What method did you use?
>>> 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-users@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-users@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: Web services.

2012-05-02 Thread Karl Sutt
Have you looked into something like Backbone.js (
http://documentcloud.github.com/backbone/) or Spine (http://spinejs.com/)?
I know this may not exactly be what you're after, but it does allow you to
define models and manipulate them asynchronously (with data being pushed to
the server via AJAX).
In Backbone, you can pass {wait: true} to all the save() calls (
http://documentcloud.github.com/backbone/#Model-save) to wait for a
response from the server, otherwise all calls are assumed to be "positive
by default" -- saving the data is assumed to be successful by default.

Cheers,

Karl Sutt


On Wed, May 2, 2012 at 11:01 PM, Sherif Shehab Aldin
wrote:
>
>
> I think my main problem is thinking about the returning objects, I want to
> make a standard way for ajax calls on my application so I can easily extend
> them, and create new ones easily, rather than thinking about it every time.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Web services.

2012-05-02 Thread Sherif Shehab Aldin
On Fri, Apr 27, 2012 at 11:02 AM, Tom Evans wrote:

> On Thu, Apr 26, 2012 at 4:20 PM, Sherif Shehab Aldin
>  wrote:
> > Hi All,
> >
> > I am developing some django apps, mostly they are adds to the django
> admin
> > interface... What I need to do a lot is adding some Ajax calls, but I am
> a
> > bit confused about weather It's better to provide those Ajax calls as web
> > services like SOAP or REST, or I just create normal views.. I need to
> > standardize those calls, I want to have a pattern to follow whenever I
> need
> > to create new Ajax call to minimize the time needed to add new
> functionality
> > and focus on the function Itself, cause currently every time I want to
> add a
> > new call, I keep asking myself this question, and It confuses me a lot.
> >
> > Also I want to ask weather REST is only used to get,post, put and object
> or
> > It can be just like a way to do RPC? cause most of examples for REST are
> > just focusing on get/post an object.
> >
> > Your thoughts are highly appreciated. :-)
> >
> > Regards,
> > Sherif.
> >
>
> It's not typical to use SOAP for AJAX calls, in fact I don't think
> I've ever seen that. TBH, it's not typical to use SOAP at all unless
> you are in the thrall of a tool manufacturer.
>
>
What you said is really interesting, as I am not very familiar with web
services in general and don't have a good view of when which one should be
used.



> REST is all about objects, but this doesn't mean that you cannot do
> RPC with REST, you just have to re-align your mindset. Instead of
> calling a remote method, your REST call creates an object that gives
> you the results you are interested in.
>
> Eg, rather than calling a search service via SOAP to get a list of
> items, you would create a SearchResults object with your arguments,
> via REST. To access the results, you would use further REST calls to
> examine attributes of the object.
>
> The best way to architecture something like this is with a task queue
> system like celery, creating a task to perform the search when the
> SearchResults object is created, and testing/waiting for results to be
> completed before returning data from attribute calls.
>
>
I think I wouldn't need the task queue cause my functions are short and
wouldn't take much processing time, so I guess It's ok to just wait for
their output.

I think my main problem is thinking about the returning objects, I want to
make a standard way for ajax calls on my application so I can easily extend
them, and create new ones easily, rather than thinking about it every time.

Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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-users@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: Good method to require EULA acceptance

2012-05-02 Thread BGMaster
That's what I have. The problem is that you then have to restrict
access on every page of your site to those who've accepted the EULA.
What I would rather do is create a profile and only allow access to
the EULA acceptance page once the person is registered and until they
accept the EULA. I'm just having a hard time conceptualizing a way to
do this code-wise.

On May 2, 5:41 pm, "Jonathan D. Baker" 
wrote:
> You could store the Eula as a boolean field on a user profile model and 
> manage it that way.
>
> Sent from my iPhone
>
> On May 2, 2012, at 3:34 PM, BGMaster  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I'm trying to implement acceptance of a EULA into my site registration
> > form. The EULA acceptance is on a separate page from the rest of the
> > registration form. I'm trying to figure out a way to prevent the user
> > from accessing the rest of the site without accepting the EULA. Every
> > path I go down seems to end up being very hackish. Has anyone done a
> > EULA in a separate view/page from the rest of the site registration?
> > What method did you use?
>
> > 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-users@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-users@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.



ListView, Formsets and Model formsets

2012-05-02 Thread Steve Kilbane
I'm sure I'm missing something obvious here...

I want to produce a form which is a list of objects in my model, with
a checkbox to select some of the objects, so that the posted data is
the list of selected objects. Just like you get on the listviews in
the admin interface, in fact.

It seems like formsets are the solution here, but neither Formset nor
ModelFormset seems to be quite right: I want a reference to my
original model, so that each form in the set is related to an object,
but I don't want *any* of the model's fields in the form - just the
checkbox. Nor do I want a database table with ForeignKeyField/
BooleanField columns - this is just transitory.

I'm sure this should be trivial, if I just squint at it right.

Thanks,

steve

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Good method to require EULA acceptance

2012-05-02 Thread Jonathan D. Baker
You could store the Eula as a boolean field on a user profile model and manage 
it that way.

Sent from my iPhone

On May 2, 2012, at 3:34 PM, BGMaster  wrote:

> Hi,
> 
> I'm trying to implement acceptance of a EULA into my site registration
> form. The EULA acceptance is on a separate page from the rest of the
> registration form. I'm trying to figure out a way to prevent the user
> from accessing the rest of the site without accepting the EULA. Every
> path I go down seems to end up being very hackish. Has anyone done a
> EULA in a separate view/page from the rest of the site registration?
> What method did you use?
> 
> 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-users@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-users@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.



Good method to require EULA acceptance

2012-05-02 Thread BGMaster
Hi,

I'm trying to implement acceptance of a EULA into my site registration
form. The EULA acceptance is on a separate page from the rest of the
registration form. I'm trying to figure out a way to prevent the user
from accessing the rest of the site without accepting the EULA. Every
path I go down seems to end up being very hackish. Has anyone done a
EULA in a separate view/page from the rest of the site registration?
What method did you use?

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-users@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: Form fields and Widget to select a directory

2012-05-02 Thread Nikolas Stevenson-Molnar
Assuming I understand you correctly, this is an HTML limitation.
Browsers do not support multiple-file upload prior to HTML5. And even
then, AFIK only webkit-based browsers will give you a way to select
directories instead of individual files.

_Nik

On 5/2/2012 11:53 AM, fanchyna wrote:
> I have a question on django which has been bothering me for a while. I
> tried to search it from the web but could not get an answer.
>
> What I want to do is to select a "directory" (only the path, not
> including file) from the local file system.
>
> When I was designing my models.py (actually, I use ModelForm since I
> already have had the models defined), either the FileField or
> FilePathField does not work because they only allow me to select file,
> rather than a directory name. Do you know how I can do that?
>
> I use FileInput as the widget for this field. But this only allows me
> to select a file, rather than a directory. Should I use another one?
>
> For the fields that I really need a file, I use FilePathField, but
> after I choose a file, the text box is not editable (everytime I put
> my cursor into the text box, the file picker prompts out). Is there
> anyway to edit the text box while keeping using the file picker?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



Server error caused by too many database look-ups

2012-05-02 Thread Jonas Ghyllebert
Hi everybody,

I've got a problem while accessing a model in the Django Adminpanel.
I uploaded the models file, i hope this makes it easier for you to 
understand my problem.

When I try to add or view a *Region *in the adminpanel, the server usually 
gives me an 500 server error.
This is what i get to see:
 
Error: Server ErrorThe server encountered an error and could not complete 
your request.

If the problem persists, please 
report your 
problem and mention this error message and the query that caused it.

Now, in the uploaded file you may (or not) have seen that I want to have 25 
fields from Zip.

My guess is that Django connects to the database for every listbox it is 
generating.
Is there a way to cache the 2000+ zips?
Or, am I seeing it wrong? What should I do then?

Greetings


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/uvmzpHMtx0gJ.
To post to this group, send email to django-users@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.

from django.db import models
from django.contrib import admin

### Zip
class Province(models.Model):
province_name = models.CharField(max_length=145)

class Meta:
verbose_name =  "provincie"

def __unicode__(self):
return self.province_name 

class Zip(models.Model):
zip_code = models.IntegerField()
zip_name = models.CharField(max_length=75)
zip_lang = models.CharField(max_length=2)
province = models.ForeignKey(Province)

class Meta:
ordering = ["zip_name"]
verbose_name = "postcode"

def __unicode__(self):
return self.zip_name + ' (' + unicode(self.zip_code) +')'

### Contact
class Contact_type(models.Model):
contact_type = models.CharField(max_length=50)
class Meta:
verbose_name = "contact type"
verbose_name_plural = "contact types"

def __unicode__(self):
return self.contact_type


### Collaborator
class Collaborator_function(models.Model):
collaborator_function_name = models.CharField(max_length=100)

class Meta:
verbose_name = "medewerker functie"
verbose_name_plural = "medewerker functies"

def __unicode__(self):
return self.collaborator_function_name

class Collaborator_type(models.Model):
Collaborator_type_name = models.CharField(max_length=100)
def __unicode__(self):
return self.Collaborator_type_name

class Meta:
verbose_name = "medewerker type"
verbose_name_plural = "medewerker types"

class Collaborator(models.Model):
collaborator_first_name = models.CharField(max_length=45)
collaborator_last_name = models.CharField(max_length=45)
collaborator_birth_year = models.DateField()
collaborator_start_year = models.DateField()
collaborator_end_year = models.DateField(blank=True,null=True)
collaborator_function = models.ForeignKey(Collaborator_function)
collaborator_type = models.ForeignKey(Collaborator_type)
collaborator_legal = models.CharField(max_length=100,blank=True,null=True)
collaborator_vat = models.CharField(max_length=100,blank=True,null=True)
collaborator_zoho_id= models.IntegerField(blank=True,null=True)
collaborator_maximmo_id = models.IntegerField(blank=True,null=True)
collaborator_biv_number = models.IntegerField(blank=True,null=True)
collaborator_drupal_id = models.IntegerField(blank=True,null=True)

def __unicode__(self):
return self.collaborator_first_name + ' ' + self.collaborator_last_name

class Meta:
verbose_name = "medewerker"
verbose_name_plural = "medewerkers"

class Contact_per_collaborator(models.Model):
collaborator = models.ForeignKey(Collaborator)
contact_link = models.CharField(max_length=150)
contact_type = models.ForeignKey(Contact_type)
def __unicode__(self):
return self.contact_link

class Meta:
verbose_name = "contact"

class commission_collaborator_percentage(models.Model):
collaborator = models.ForeignKey(Collaborator)
commission_collaborator_percentage = models.IntegerField()
commission_collaborator_start_date = models.DateField()
commission_collaborator_end_date = models.DateField()

class Meta:
verbose_name = "Medewerker commissie (percentage)"
verbose_name_plural = "Medewerker commissies (percentage)"

### Office
class Office(models.Model):
office_name = models.CharField(max_length=100)
office_legal = models.CharField(max_length=100)
office_address_street = models.CharField(max_length=100)
office_address_number = models.CharField(max_length=25)
 

Form fields and Widget to select a directory

2012-05-02 Thread fanchyna
I have a question on django which has been bothering me for a while. I
tried to search it from the web but could not get an answer.

What I want to do is to select a "directory" (only the path, not
including file) from the local file system.

When I was designing my models.py (actually, I use ModelForm since I
already have had the models defined), either the FileField or
FilePathField does not work because they only allow me to select file,
rather than a directory name. Do you know how I can do that?

I use FileInput as the widget for this field. But this only allows me
to select a file, rather than a directory. Should I use another one?

For the fields that I really need a file, I use FilePathField, but
after I choose a file, the text box is not editable (everytime I put
my cursor into the text box, the file picker prompts out). Is there
anyway to edit the text box while keeping using the file picker?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Port Django to Javascript

2012-05-02 Thread yati sagade
With ya. Let me get done with my exams, and hopefully I'll be able to
contribute(and use, obviously) :)
PS: Why the name Broke?? :O

On Wed, May 2, 2012 at 9:45 PM, DvD  wrote:

> Actually, I already put together some code that works on node.js inspired
> by Django, have a look https://github.com/brokenseal/broke
> My original intention was to create a framework that would work seamlessly
> on the server and on the client side but it was just too much for me that I
> left that project aside to concentrate on the client side only with
> https://github.com/brokenseal/broke-client
>
> I'm not asking help to start the project, I'm asking for help to make an
> already existing project a kick ass open source project with a community
> around it and I think that this is the right place since we all share
> Django love :)
>
>
> Il giorno mercoledì 2 maggio 2012 16:11:45 UTC+2, yati sagade ha scritto:
>
>> I am a Django user, but I don't see anything wrong in a JS framework
>> inspired by Django. Afterall, only great things can inspire. But I fail to
>> understand why JavaScript has to be only client side - It is a perfectly
>> valid choice as a server side language for not all, but certainly some use
>> cases. Besides, the server-side portion and the client-side portions can
>> share code. I recently wrapped up a project that involved using 
>> Node.jsin the backend, and man how I missed Django there. 
>> The current sane choice
>> for a web framework on top of Node is Express.js 
>> (Node is itself very low level) - which is inspired by
>> Sinatra , a web development framework(they
>> call it a DSL) for Ruby. My point is when something inspired by a Ruby
>> server-side framework can become the de-facto standard choice for the
>> Node.js community, why not let them taste Django? I personally find the
>> idea compelling, but *only* if the server-side capabilities of the language
>> are respected. If we look solely at the client side, no-one would want to
>> ditch jQuery/Prototype ;)
>>
>> Now for the motivation, I would always love to hack together a quick app
>> using the same language(and importantly, the same mindset) both on the
>> server and client sides ;) And yes, with the WebWorkers API ported to
>> work with 
>> Node.js(never tried) 
>> we are going to see some serious advancements.
>>
>> I understand people's minds have been brutally injured by JavaScript in
>> the past(I'm one of them), but then it *is* a capable language, and it
>> doesn't harm if someone is willing enough to bring reusability and
>> structure to apps written in it by means of a framework.
>>
>> Cheers!
>>
>> On Wed, May 2, 2012 at 3:02 PM, N.Aleksandrenko 
>> wrote:
>>
>>> Why do you want to port django to javascript, there are great js libs
>>> and frameworks. It will be better to make a js bundle for django
>>> making in ajax ready.
>>> Js Tools working out of the box. Such as:
>>> + ajax upload
>>> + ajax registration with error handeling
>>> + ajax pages
>>> + binding django and a js framework (as backbone)
>>> + bind django with ad ui library (as jquery ui)
>>>
>>> and much more basic stuff
>>>
>>> Building the apps with django is still not DRY. If you are a frontend
>>> developer you can make a bundle to make django better and many people
>>> may find it helpfull and use it.
>>> If you decide to start such project ... call :) me i can i will help
>>> with ideas and code.
>>>
>>>
>>>
>>> On Wed, May 2, 2012 at 11:51 AM, Gerald Klein  wrote:
>>> > Maybe I missed an earlier post but I am always looking for new projects
>>> > please explain your requirements.
>>> >
>>> > --jerry
>>> >
>>> >
>>> > On Wed, May 2, 2012 at 2:15 AM, DvD  wrote:
>>> >>
>>> >> Hey,
>>> >> is no one is really interested in helping in this project?
>>> >>
>>> >> --
>>> >> You received this message because you are subscribed to the Google
>>> Groups
>>> >> "Django users" group.
>>> >> To view this discussion on the web visit
>>> >> https://groups.google.com/d/**msg/django-users/-/kQ_**GesNzV7wJ
>>> .
>>> >> To post to this group, send email to django-users@googlegroups.com.
>>> >> To unsubscribe from this group, send email to
>>> >> django-users+unsubscribe@**googlegroups.com
>>> .
>>> >> For more options, visit this group at
>>> >> http://groups.google.com/**group/django-users?hl=en
>>> .
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> >
>>> > Gerald Klein DBA
>>> >
>>> > contac...@geraldklein.com
>>> >
>>> > www.geraldklein.com
>>> >
>>> > j...@zognet.com
>>> >
>>> > 708-599-0352
>>> >
>>> >
>>> > Linux registered user #548580
>>> >
>>> >
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "Django users" group.
>>> > To post to this group, send email to django-users@googlegroups.com.

Re: Hello, everyone.I come from China.I like python,

2012-05-02 Thread Gerald Klein
I have been around a long time but I keep on learning new things

On Wed, May 2, 2012 at 11:09 AM, M Hussain  wrote:

> Hello
>
> me too a newbie ;) but Gerald you seems like a veteran from your site.
> I hope we are't spamming.
>
> Regards
> Hussain
>
>
>
> On Wed, May 2, 2012 at 6:01 PM, Gerald Klein  wrote:
>
>> Welcome from one noob to another
>>
>>
>> On Wed, May 2, 2012 at 10:24 AM, zbpython-cn  wrote:
>>
>>> Hello, everyone.I come from China.I like python, so I taught myself
>>> python is now in self-study the django.
>>> After the exhibitions, and welcome to play.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To post to this group, send email to django-users@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.
>>>
>>>
>>
>>
>> --
>>
>> Gerald Klein DBA
>>
>> contac...@geraldklein.com
>>
>> www.geraldklein.com 
>>
>> j...@zognet.com
>>
>> 708-599-0352
>>
>>
>> Linux registered user #548580
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@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-users@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.
>



-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

j...@zognet.com

708-599-0352


Linux registered user #548580

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Hello, everyone.I come from China.I like python,

2012-05-02 Thread Gerald Klein
See that's what I thought but I was corrected by mr Tustin

On Wed, May 2, 2012 at 11:31 AM, Joel Goldstick wrote:

> On Wed, May 2, 2012 at 12:24 PM, Gerald Klein  wrote:
> > ? I am not sure what that means.
> >
> >
> > On Wed, May 2, 2012 at 11:19 AM, Amao Zhao  wrote:
> >>
> >> Noob ~~
> >>
> >> 在 2012年5月3日星期四,Gerald Klein 写道:
> >>>
> >>> Welcome from one noob to another
> >>>
> >>> On Wed, May 2, 2012 at 10:24 AM, zbpython-cn  wrote:
> 
>  Hello, everyone.I come from China.I like python, so I taught myself
>  python is now in self-study the django.
>  After the exhibitions, and welcome to play.
> 
>  --
>  You received this message because you are subscribed to the Google
>  Groups "Django users" group.
>  To post to this group, send email to django-users@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.
> 
> >>>
> >>>
> >>>
> >>> --
> >>>
> >>> Gerald Klein DBA
> >>>
> >>> contac...@geraldklein.com
> >>>
> >>> www.geraldklein.com
> >>>
> >>> j...@zognet.com
> >>>
> >>> 708-599-0352
> >>>
> >>>
> >>> Linux registered user #548580
> >>>
> >>>
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups
> >>> "Django users" group.
> >>> To post to this group, send email to django-users@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-users@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.
> >
> >
> >
> >
> > --
> >
> > Gerald Klein DBA
> >
> > contac...@geraldklein.com
> >
> > www.geraldklein.com
> >
> > j...@zognet.com
> >
> > 708-599-0352
> >
> >
> > Linux registered user #548580
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@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.
>
> haha! its shortened version of noobie which is slang for a new learner
>
> --
> Joel Goldstick
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.
>
>


-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

j...@zognet.com

708-599-0352


Linux registered user #548580

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Short I hope explanation

2012-05-02 Thread Gerald Klein
ok thanks I will give that a look.

On Wed, May 2, 2012 at 11:35 AM, Joel Goldstick wrote:

> On Wed, May 2, 2012 at 11:50 AM, Gerald Klein  wrote:
> > Hi, I have been through a couple of tutorials including the one on the
> site,
> > the one thing that the authors have in common is they seem to want to
> jump
> > to the 'short cuts' to soon. I like to know the basic long hand version
> > first because I want to understand.
> >
> > What I am having a problem with is generics. I did a tutorial and
> couldn't
> > get the generics to all work. So I wanted to do it the hard way and move
> on
> > then go back when I know more.
> >
> > I need an example of a queried result set.
> >
> > the 'get_absolute_url' from the model
> > with the query line and render_to_response from the view and
> > the regex url from URLConf without the generic references
> > that should be enough to get me going if someone could just cut and
> paste in
> > some arbitrary code I would be very gratefull
> >
> > thanks
> >
> > --jerry
> >
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@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.
>
>
> Have you checked out the djangobook.com http://www.djangobook.com/en/2.0/
>
> Its a little dated in that it doesn't cover Class based generic views.
>  But it does walk you thru the individual pieces before it puts them
> together and then rolls into the shortcuts
>
>
> --
> Joel Goldstick
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.
>
>


-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

j...@zognet.com

708-599-0352


Linux registered user #548580

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Hello, everyone.I come from China.I like python,

2012-05-02 Thread Gerald Klein
Hence the question I always seen that as short for new-be

On Wed, May 2, 2012 at 11:29 AM, Marcin Tustin wrote:

> Try translating it with:  http://translate.google.com/  (It works!)
>
> On Wed, May 2, 2012 at 5:24 PM, Gerald Klein  wrote:
>
>> ? I am not sure what that means.
>>
>>
>> On Wed, May 2, 2012 at 11:19 AM, Amao Zhao  wrote:
>>
>>> Noob ~~
>>>
>>> 在 2012年5月3日星期四,Gerald Klein 写道:
>>>
 Welcome from one noob to another

 On Wed, May 2, 2012 at 10:24 AM, zbpython-cn  wrote:

> Hello, everyone.I come from China.I like python, so I taught myself
> python is now in self-study the django.
> After the exhibitions, and welcome to play.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django-users@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.
>
>


 --

 Gerald Klein DBA

 contac...@geraldklein.com

 www.geraldklein.com 

 j...@zognet.com

 708-599-0352


 Linux registered user #548580



  --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To post to this group, send email to django-users@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-users@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.
>>>
>>
>>
>>
>> --
>>
>> Gerald Klein DBA
>>
>> contac...@geraldklein.com
>>
>> www.geraldklein.com 
>>
>> j...@zognet.com
>>
>> 708-599-0352
>>
>>
>> Linux registered user #548580
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@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.
>>
>
>
>
> --
> Marcin Tustin
> Tel: 07773 787 105
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.
>



-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

j...@zognet.com

708-599-0352


Linux registered user #548580

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Short I hope explanation

2012-05-02 Thread Joel Goldstick
On Wed, May 2, 2012 at 11:50 AM, Gerald Klein  wrote:
> Hi, I have been through a couple of tutorials including the one on the site,
> the one thing that the authors have in common is they seem to want to jump
> to the 'short cuts' to soon. I like to know the basic long hand version
> first because I want to understand.
>
> What I am having a problem with is generics. I did a tutorial and couldn't
> get the generics to all work. So I wanted to do it the hard way and move on
> then go back when I know more.
>
> I need an example of a queried result set.
>
> the 'get_absolute_url' from the model
> with the query line and render_to_response from the view and
> the regex url from URLConf without the generic references
> that should be enough to get me going if someone could just cut and paste in
> some arbitrary code I would be very gratefull
>
> thanks
>
> --jerry
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.


Have you checked out the djangobook.com http://www.djangobook.com/en/2.0/

Its a little dated in that it doesn't cover Class based generic views.
 But it does walk you thru the individual pieces before it puts them
together and then rolls into the shortcuts


-- 
Joel Goldstick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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 timezone doesn't show the right time?

2012-05-02 Thread Dan Santos
Thanks!  I guess that I will see the light once I get to part 3 of the 
tutorial.  Thanks for the pointer now I understand the big picture.



On Monday, April 30, 2012 10:03:25 PM UTC+2, Dan Santos wrote:
>
> Hi I'm a total programming newbie! 
>
> ### INTRO ### 
> I have been following this tutorial and the timezone outputs confuses 
> me. 
>
> https://docs.djangoproject.com/en/1.4/intro/tutorial01/#playing-with-the-api 
>
> And I'm still confused after reading these explanations, I basically 
> need some really dumbed down answers to understand this timezone 
> business: 
>
> TIME_ZONE setting: How does it work? 
>
> http://groups.google.com/group/django-users/browse_thread/thread/bebbc1310f24e945/100d0fc3e8620684?lnk=gst&q=timezone+problems#
>  
>
>
>
> ### QUESTION ### 
> * Europe/Brussels has UTC+2 during summer time. 
>
> When I run this as I follow the Django tutorial, then the time (20:34) 
> is behind by 2 hours to my local time and UTC displays +00:00. 
> Shouldn't it display 22:34 +02:00 instead for a server located at 
> Europe/Brussels? 
>
> >>> Poll.objects.all() 
> ] 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/A_32ZkEl-VAJ.
To post to this group, send email to django-users@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: Hello, everyone.I come from China.I like python,

2012-05-02 Thread Joel Goldstick
On Wed, May 2, 2012 at 12:24 PM, Gerald Klein  wrote:
> ? I am not sure what that means.
>
>
> On Wed, May 2, 2012 at 11:19 AM, Amao Zhao  wrote:
>>
>> Noob ~~
>>
>> 在 2012年5月3日星期四,Gerald Klein 写道:
>>>
>>> Welcome from one noob to another
>>>
>>> On Wed, May 2, 2012 at 10:24 AM, zbpython-cn  wrote:

 Hello, everyone.I come from China.I like python, so I taught myself
 python is now in self-study the django.
 After the exhibitions, and welcome to play.

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To post to this group, send email to django-users@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.

>>>
>>>
>>>
>>> --
>>>
>>> Gerald Klein DBA
>>>
>>> contac...@geraldklein.com
>>>
>>> www.geraldklein.com
>>>
>>> j...@zognet.com
>>>
>>> 708-599-0352
>>>
>>>
>>> Linux registered user #548580
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@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-users@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.
>
>
>
>
> --
>
> Gerald Klein DBA
>
> contac...@geraldklein.com
>
> www.geraldklein.com
>
> j...@zognet.com
>
> 708-599-0352
>
>
> Linux registered user #548580
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.

haha! its shortened version of noobie which is slang for a new learner

-- 
Joel Goldstick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Hello, everyone.I come from China.I like python,

2012-05-02 Thread Gerald Klein
? I am not sure what that means.

On Wed, May 2, 2012 at 11:19 AM, Amao Zhao  wrote:

> Noob ~~
>
> 在 2012年5月3日星期四,Gerald Klein 写道:
>
>> Welcome from one noob to another
>>
>> On Wed, May 2, 2012 at 10:24 AM, zbpython-cn  wrote:
>>
>>> Hello, everyone.I come from China.I like python, so I taught myself
>>> python is now in self-study the django.
>>> After the exhibitions, and welcome to play.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To post to this group, send email to django-users@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.
>>>
>>>
>>
>>
>> --
>>
>> Gerald Klein DBA
>>
>> contac...@geraldklein.com
>>
>> www.geraldklein.com 
>>
>> j...@zognet.com
>>
>> 708-599-0352
>>
>>
>> Linux registered user #548580
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@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-users@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.
>



-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

j...@zognet.com

708-599-0352


Linux registered user #548580

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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 would I go about building an API converter?

2012-05-02 Thread Alec Taylor
On Thu, May 3, 2012 at 12:52 AM, HarpB  wrote:
> I am a big fan of TastyPie. But I don't understand your following
> requirement:
>
> Get/set (conversion) between different schemas
>
> I.e.: No matter the input API, you can get it formatted in whichever output
> API you request
>
> Are you simply trying to create a unified interface for all of you existing
> APIs? If so, are they using Django models?

They seem to be mostly written from C#, all the information they are
giving me is an auto-generated schema page with set/get examples in
SOAP [for one service] and XML [for the other]. I suspect that a few
of the others will be in JSON though.

> TastyPie would only be useful for you if you have existing Django Models.
> You could still use it without having Django models, but then you would
> have to write lot more of the api code yourself. TastyPie is a full-featured,
> drop-in API system. It is meant to simply included into your existing
> code, your attach it to your Django model and it will serve the data
> associated to the models. It provides all of the RESTful options: GET,
> POST, DELETE and PUT.
>
>
> Django-Piston also makes use of django models, but it does not solely relies
> on it. It provides a very basic interface (in comparison to TastyPie) and
> you would need to write all of the RESTful request handles yourself.
>
>
> Both TastyPie and Piston have authentication and authorization system.
>

The functionality I'm providing is as follows:

Server1 >[send as SOAP 1.1]>[My Server]>[Server3 receives as XML in
Server3 schema]
Server3>[Send as XML]>[My Server]>[Server1 receives as SOAP 1.1 in
Server1 schema]

However since they will still need to access the data on demand (and
not wait for a set/get operation from another party) I will need to
create models (database) storing all information received.

What would be the best way of doing this?

Would TastyPie still be a good choice, or would Django-Piston [or some
other] better suit this problem?

Thanks for all suggestions,

Alec Taylor

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Port Django to Javascript

2012-05-02 Thread DvD
Actually, I already put together some code that works on node.js inspired 
by Django, have a look https://github.com/brokenseal/broke
My original intention was to create a framework that would work seamlessly 
on the server and on the client side but it was just too much for me that I 
left that project aside to concentrate on the client side only 
with https://github.com/brokenseal/broke-client

I'm not asking help to start the project, I'm asking for help to make an 
already existing project a kick ass open source project with a community 
around it and I think that this is the right place since we all share 
Django love :)


Il giorno mercoledì 2 maggio 2012 16:11:45 UTC+2, yati sagade ha scritto:
>
> I am a Django user, but I don't see anything wrong in a JS framework 
> inspired by Django. Afterall, only great things can inspire. But I fail to 
> understand why JavaScript has to be only client side - It is a perfectly 
> valid choice as a server side language for not all, but certainly some use 
> cases. Besides, the server-side portion and the client-side portions can 
> share code. I recently wrapped up a project that involved using 
> Node.jsin the backend, and man how I missed Django there. 
> The current sane choice 
> for a web framework on top of Node is Express.js (Node 
> is itself very low level) - which is inspired by 
> Sinatra , a web development framework(they 
> call it a DSL) for Ruby. My point is when something inspired by a Ruby 
> server-side framework can become the de-facto standard choice for the 
> Node.js community, why not let them taste Django? I personally find the 
> idea compelling, but *only* if the server-side capabilities of the language 
> are respected. If we look solely at the client side, no-one would want to 
> ditch jQuery/Prototype ;)
>
> Now for the motivation, I would always love to hack together a quick app 
> using the same language(and importantly, the same mindset) both on the 
> server and client sides ;) And yes, with the WebWorkers API ported to 
> work with Node.js 
> (never tried) we are 
> going to see some serious advancements.
>
> I understand people's minds have been brutally injured by JavaScript in 
> the past(I'm one of them), but then it *is* a capable language, and it 
> doesn't harm if someone is willing enough to bring reusability and 
> structure to apps written in it by means of a framework.
>
> Cheers!
>
> On Wed, May 2, 2012 at 3:02 PM, N.Aleksandrenko 
> wrote:
>
>> Why do you want to port django to javascript, there are great js libs
>> and frameworks. It will be better to make a js bundle for django
>> making in ajax ready.
>> Js Tools working out of the box. Such as:
>> + ajax upload
>> + ajax registration with error handeling
>> + ajax pages
>> + binding django and a js framework (as backbone)
>> + bind django with ad ui library (as jquery ui)
>>
>> and much more basic stuff
>>
>> Building the apps with django is still not DRY. If you are a frontend
>> developer you can make a bundle to make django better and many people
>> may find it helpfull and use it.
>> If you decide to start such project ... call :) me i can i will help
>> with ideas and code.
>>
>>
>>
>> On Wed, May 2, 2012 at 11:51 AM, Gerald Klein  wrote:
>> > Maybe I missed an earlier post but I am always looking for new projects
>> > please explain your requirements.
>> >
>> > --jerry
>> >
>> >
>> > On Wed, May 2, 2012 at 2:15 AM, DvD  wrote:
>> >>
>> >> Hey,
>> >> is no one is really interested in helping in this project?
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google 
>> Groups
>> >> "Django users" group.
>> >> To view this discussion on the web visit
>> >> https://groups.google.com/d/msg/django-users/-/kQ_GesNzV7wJ.
>> >> To post to this group, send email to django-users@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.
>> >
>> >
>> >
>> >
>> > --
>> >
>> > Gerald Klein DBA
>> >
>> > contac...@geraldklein.com
>> >
>> > www.geraldklein.com
>> >
>> > j...@zognet.com
>> >
>> > 708-599-0352
>> >
>> >
>> > Linux registered user #548580
>> >
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google 
>> Groups
>> > "Django users" group.
>> > To post to this group, send email to django-users@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-users@googlegroups.com.
>> To unsubscribe from this grou

Re: Hello, everyone.I come from China.I like python,

2012-05-02 Thread Gerald Klein
Welcome from one noob to another

On Wed, May 2, 2012 at 10:24 AM, zbpython-cn  wrote:

> Hello, everyone.I come from China.I like python, so I taught myself
> python is now in self-study the django.
> After the exhibitions, and welcome to play.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.
>
>


-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

j...@zognet.com

708-599-0352


Linux registered user #548580

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



Hello, everyone.I come from China.I like python,

2012-05-02 Thread zbpython-cn
Hello, everyone.I come from China.I like python, so I taught myself
python is now in self-study the django.
After the exhibitions, and welcome to play.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



GET parameters and custom admin query filters

2012-05-02 Thread Daniel Sokolowski
As per 'https://docs.djangoproject.com/en/1.3/releases/1.2.4/
#restricted-filters-in-admin-interface' to be able to create GET
parameters  on the fly one has to add it to the
`ModelAdmin.list_filter` setting.

That's what I have been doing however on my latest project I am using
a custom admin filter that returns active entires only so my GET
filter queries are now throwing:

SuspiciousOperation at /admin/time_sheets/timesheetentry/
Filtering by project__company__id__exact not allowed

I have set the custom's filter parameter_name = 'project__company__id'
or `project__company` but the result is the same. Is this a bug? how
does one list `active__company` so that GET parameters work? As a work
around for now I added both my custom filter and 'project__company' to
the `list_filter` setting.

# ./admin.py
class TimeSheetEntryAdmin(admin.ModelAdmin):
...
list_filter = ['employee', 'status', ActiveCompaniesFilter, ...,
'project__company`]

# ./admin_filters.py
...
class ActiveCompaniesFilter(SimpleListFilter):
title = _('active companies')
parameter_name = 'project__company__id'
   def lookups(self, request, model_admin):
lookup_list = Company.objects.active().values_list('id',
'name').distinct()
return lookup_list

def queryset(self, request, queryset):
if self.value():
return queryset.filter(project__company=self.value())

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



Short I hope explanation

2012-05-02 Thread Gerald Klein
Hi, I have been through a couple of tutorials including the one on the
site, the one thing that the authors have in common is they seem to want to
jump to the 'short cuts' to soon. I like to know the basic long hand
version first because I want to understand.

What I am having a problem with is generics. I did a tutorial and couldn't
get the generics to all work. So I wanted to do it the hard way and move on
then go back when I know more.

I need an example of a queried result set.

the 'get_absolute_url' from the model
with the query line and render_to_response from the view and
the regex url from URLConf without the generic references
that should be enough to get me going if someone could just cut and paste
in some arbitrary code I would be very gratefull

thanks

--jerry

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: cPanel Python/Django support

2012-05-02 Thread shacker
On Wednesday, May 2, 2012 2:52:09 AM UTC-7, Gabriel - Iulian Dumbrava wrote:
>
> Unfortunately to make it more useful to deploy django, some hosting 
> providers should stop providing CentOS with Python 2.4. I just got another 
> server with this flavour and I had to install my own version of Python.
>

Yep, agreed.  I'm confident they will be bundling an updated Python when/if 
this feature is released.

./s


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/eq-uiTN60tgJ.
To post to this group, send email to django-users@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 would I go about building an API converter?

2012-05-02 Thread HarpB
I am a big fan of TastyPie. But I don't understand your following 
requirement:

   - *Get/set (conversion) between different schemas* 
  - I.e.: No matter the input API, you can get it formatted in 
  whichever output API you request
   
Are you simply trying to create a unified interface for all of you existing 
APIs? If so, are they using Django models? TastyPie would only be useful 
for you if you have existing Django Models. You could still use it without 
having Django models, but then you would have to write lot more of the api 
code yourself. TastyPie is a full-featured, drop-in API system. It is meant 
to simply included into your existing code, your attach it to your Django 
model and it will serve the data associated to the models. It provides all 
of the RESTful options: GET, POST, DELETE and PUT. 


Django-Piston also makes use of django models, but it does not solely 
relies on it. It provides a very basic interface (in comparison to 
TastyPie) and you would need to write all of the RESTful request handles 
yourself.


Both TastyPie and Piston have authentication and authorization system.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/LOLDecKzQBEJ.
To post to this group, send email to django-users@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.



hop by hop errors..

2012-05-02 Thread hanj99
Hi~~
I'm using Django 1.4. to implement RESTful service. And for a
compatibility test with S3 Amazon API, I'm using a s3browser.( which
is famous among amazon storage users)

But, I have a problem when I try to do the following.

response = HttpResponse()
response['transfer-encoding'] = 'chunked'

The error is 'hop-by-hop header is not allowed'


When I used Django 1.3, the problem could be solved by

del hop_headers['transfer-encoding']

But, after I upgraded Django to 1.4, I can't find any
hop header related codes anywhere :(

Please let me know where in the codes I should look into..

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Port Django to Javascript

2012-05-02 Thread yati sagade
I am a Django user, but I don't see anything wrong in a JS framework
inspired by Django. Afterall, only great things can inspire. But I fail to
understand why JavaScript has to be only client side - It is a perfectly
valid choice as a server side language for not all, but certainly some use
cases. Besides, the server-side portion and the client-side portions can
share code. I recently wrapped up a project that involved using
Node.jsin the backend, and man how I missed Django
there. The current sane choice
for a web framework on top of Node is Express.js
(Node is itself very low level) - which is
inspired by
Sinatra , a web development framework(they call
it a DSL) for Ruby. My point is when something inspired by a Ruby
server-side framework can become the de-facto standard choice for the
Node.js community, why not let them taste Django? I personally find the
idea compelling, but *only* if the server-side capabilities of the language
are respected. If we look solely at the client side, no-one would want to
ditch jQuery/Prototype ;)

Now for the motivation, I would always love to hack together a quick app
using the same language(and importantly, the same mindset) both on the
server and client sides ;) And yes, with the WebWorkers API ported to work
with Node.js (never
tried) we are going to see some serious advancements.

I understand people's minds have been brutally injured by JavaScript in the
past(I'm one of them), but then it *is* a capable language, and it doesn't
harm if someone is willing enough to bring reusability and structure to
apps written in it by means of a framework.

Cheers!

On Wed, May 2, 2012 at 3:02 PM, N.Aleksandrenko wrote:

> Why do you want to port django to javascript, there are great js libs
> and frameworks. It will be better to make a js bundle for django
> making in ajax ready.
> Js Tools working out of the box. Such as:
> + ajax upload
> + ajax registration with error handeling
> + ajax pages
> + binding django and a js framework (as backbone)
> + bind django with ad ui library (as jquery ui)
>
> and much more basic stuff
>
> Building the apps with django is still not DRY. If you are a frontend
> developer you can make a bundle to make django better and many people
> may find it helpfull and use it.
> If you decide to start such project ... call :) me i can i will help
> with ideas and code.
>
>
>
> On Wed, May 2, 2012 at 11:51 AM, Gerald Klein  wrote:
> > Maybe I missed an earlier post but I am always looking for new projects
> > please explain your requirements.
> >
> > --jerry
> >
> >
> > On Wed, May 2, 2012 at 2:15 AM, DvD  wrote:
> >>
> >> Hey,
> >> is no one is really interested in helping in this project?
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Django users" group.
> >> To view this discussion on the web visit
> >> https://groups.google.com/d/msg/django-users/-/kQ_GesNzV7wJ.
> >> To post to this group, send email to django-users@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.
> >
> >
> >
> >
> > --
> >
> > Gerald Klein DBA
> >
> > contac...@geraldklein.com
> >
> > www.geraldklein.com
> >
> > j...@zognet.com
> >
> > 708-599-0352
> >
> >
> > Linux registered user #548580
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@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-users@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.
>
>


-- 
Yati Sagade 

Twitter: @yati_itay 

Organizing member of TEDx EasternMetropolitanBypass
http://www.ted.com/tedx/events/4933
https://www.facebook.com/pages/TEDx-EasternMetropolitanBypass/337763226244869

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: [Deploy] - Missing css, js ...

2012-05-02 Thread Marcin Tustin
This is not a django question. It relates to your deployment setup. Ask at
the forums for your host. In addition, this does not contain anything like
the detail that anyone anywhere would need to answer.

On Wed, May 2, 2012 at 3:06 PM, MN TS  wrote:

>  Hello Comrades ,
>
> I'm starting with Django and I have a bluehost,
> My problem is that : i missed css , js (media)
>
> I create symbol link but its not working.
>
> ln -s /home5/user/public_html/MyProject/src/app/static/ static
>
> Do you know why is happen
> this to me?
>
> Regards
> Tsolmon.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.
>



-- 
Marcin Tustin
Tel: 07773 787 105

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



[Deploy] - Missing css, js ...

2012-05-02 Thread MN TS
 Hello Comrades ,

I'm starting with Django and I have a bluehost,
My problem is that : i missed css , js (media)

I create symbol link but its not working.

ln -s /home5/user/public_html/MyProject/src/app/static/ static

Do you know why is happen
this to me?

Regards
Tsolmon.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: a very simple beginners question

2012-05-02 Thread Shawn Milochik

On 05/02/2012 08:59 AM, alon wrote:

running

$python manager.py shell

opens a python shell
is there any way (a parameter) to make the manager run a python file
with my commands??

thanks

If you have iPython installed then running manage.py shell will run in 
iPython.


Then, you can use iPython's %run command to execute your script.

If you don't have iPython installed then you should.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@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: a very simple beginners question

2012-05-02 Thread Scott Gould
Are you looking for custom management commands?

https://docs.djangoproject.com/en/dev/howto/custom-management-commands/

On May 2, 8:59 am, alon  wrote:
> running
>
> $python manager.py shell
>
> opens a python shell
> is there any way (a parameter) to make the manager run a python file
> with my commands??
>
> 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-users@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: i18n - local translation does not show up - bug

2012-05-02 Thread Ramiro Morales
On Wed, May 2, 2012 at 4:13 AM, kenneth gonsalves
 wrote:
> hi,
>
> I want two languages in my project - en and ta. I have set this up in
> many projects over the years and this is the first time I am seeing
> failure. The problem is that on switching to tamil, the django strings
> are getting translated, but not the local strings. Django is obviously
> not finding my local .mo file. Makemessages and compilemessages work
> fine. My locale directory is at the same level as manage.py. Even if I
> put it at the same level as settings.py, it still does not work.
>
> django version - latest trunk
>
> later: on checking, this works upto revision 17860 and breaks from 17861

Well if you are using the development version it is assumed you are closely
following the development activity (so this kind of changes don't take you by
surprise) and/or can read the Fine Manual where the decprecation
and the steps you need to take are (and have been since Django 1.3 Apr 2011)
documented.

Two hints: The Django 1.3 release notes and the LOCALE_PATHS setting.

-- 
Ramiro Morales

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: a very simple beginners question

2012-05-02 Thread spawgi
1. Can you please tell us what the context is or why you want to do that?
2. I suppose you might want to check the source of manage.py and change the
way arguments to this file are handled.



On Wed, May 2, 2012 at 6:29 PM, alon  wrote:

> running
>
> $python manager.py shell
>
> opens a python shell
> is there any way (a parameter) to make the manager run a python file
> with my commands??
>
> 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-users@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.
>
>


-- 
http://spawgi.wordpress.com
We can do it and do it better.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



a very simple beginners question

2012-05-02 Thread alon
running

$python manager.py shell

opens a python shell
is there any way (a parameter) to make the manager run a python file
with my commands??

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-users@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.



Upload file and primary key - double save

2012-05-02 Thread Leonardo Giordani
Hi all,

I'm developing a site where the object Project is referenced by zero or
more objects Image, say basically

 CODE 

class Projects(models.Model):
 pass

class Image(models.Model):
 project = models.ForeignKey(Project)

---

I would like to have all images served as 001.jpeg, 002.jpeg and so on, and
I'd prefer to host them locally in a per-project subdirectory of my media
storage path.

I can implement a new save() to create a media subdirectory called with a
name containing the Project PK.

How can I move all images (previously saved in a directory specified in
Image's upload_to parameter) to the new directory?
Is the Project's save() the correct place to do this?

Thank you in advance

Leo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



'ascii' codec can't encode characters in position 36-38: ordinal not in range(128)

2012-05-02 Thread Bastian
This happens when trying to upload a file with a filename that is not in 
ascii. In this case I tried éè´´çoöp_iI$.jpg. The strange thing is that 
firefox uploads it but chrome gets the error!
I know this has been discussed already but the solutions mentioned did not 
work: I tried to change encoding = "ascii" to encoding = "utf-8" in site.py 
then I tried to add export LANG='en_US.UTF-8' and export 
LC_ALL='en_US.UTF-8' in Apache envvars.
The problem seems to be in the path since it happens at save time and the 
genericpath.py / exists is called to verify the path and returns what 
follows. Any hint is welcome. This is an ubuntu server but it happens also 
on the debian box. Django 1.3.1, python 2.7. The view is a form with 
request.POST that is saved.


   
   1. 
   2. 
   
   # Does a path exist?
   
   3. 
   
   # This is false for dangling symbolic links on systems that support them.
   
   4. 
   
   def exists(path):
   
   5. 
   
   """Test whether a path exists.  Returns False for broken symbolic 
links"""
   
   6. 
   
   try:
   
   

   1. 
   
   os.stat(path)
   
   ...


   1. 
   
   except os.error:
   
   2. 
   
   return False
   
   3. 
   
   return True
   
   4. 
   5. 
   6. 
   
   # This follows symbolic links, so both islink() and isdir() can be true
   
   
▼ Local vars 
VariableValuepath

u'/home/dev/user_media/imgs/\xe9\xe8\xe7o\xf6p_iI.jpg'


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/HkD7blsGkrsJ.
To post to this group, send email to django-users@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: TabularInline Image js bug when adding

2012-05-02 Thread josiano
actually it looks like it's a missing CSS that was the culprit:

.empty-form { display-none }

this is gone from my online version and I dunno why...

anyway, fixed it now =)

j

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/NEV5Y1HwGX0J.
To post to this group, send email to django-users@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: ValueError: unknown locale: UTF-8

2012-05-02 Thread Timothy Makobu
The Fix:
http://patrick.arminio.info/blog/2012/02/fix-valueerror-unknown-locale-utf8/




On Tue, May 1, 2012 at 3:08 PM, Timothy Makobu
wrote:

> Update:
>
> When I downgraded to 1.3, everything worked ok. So I'll be using 1.3 for a
> while now to avoid surprises.
>
>
> On Sun, Apr 29, 2012 at 1:45 PM, Timothy Makobu <
> makobu.mwambir...@gmail.com> wrote:
>
>> The database is PostgreSQL 9.1.3
>>
>>
>>
>> On Sun, Apr 29, 2012 at 1:09 PM, Timothy Makobu <
>> makobu.mwambir...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I'm getting an "unknown locale" exception and yet the LANG environment
>>> variable is set:
>>>
>>> Traceback (most recent call last):
>>>   File "manage.py", line 14, in 
>>> execute_manager(settings)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>>> line 459, in execute_manager
>>> utility.execute()
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>>> line 382, in execute
>>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/core/management/base.py",
>>> line 196, in run_from_argv
>>> self.execute(*args, **options.__dict__)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/core/management/base.py",
>>> line 232, in execute
>>> output = self.handle(*args, **options)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/core/management/base.py",
>>> line 371, in handle
>>> return self.handle_noargs(**options)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/south/management/commands/syncdb.py",
>>> line 90, in handle_noargs
>>> syncdb.Command().execute(**options)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/core/management/base.py",
>>> line 232, in execute
>>> output = self.handle(*args, **options)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/core/management/base.py",
>>> line 371, in handle
>>> return self.handle_noargs(**options)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py",
>>> line 110, in handle_noargs
>>> emit_post_sync_signal(created_models, verbosity, interactive, db)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/core/management/sql.py",
>>> line 189, in emit_post_sync_signal
>>> interactive=interactive, db=db)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py",
>>> line 172, in send
>>> response = receiver(signal=self, sender=sender, **named)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
>>> line 73, in create_superuser
>>> call_command("createsuperuser", interactive=True, database=db)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>>> line 150, in call_command
>>> return klass.execute(*args, **defaults)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/core/management/base.py",
>>> line 232, in execute
>>> output = self.handle(*args, **options)
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py",
>>> line 70, in handle
>>> default_username = get_default_username()
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
>>> line 105, in get_default_username
>>> default_username = get_system_username()
>>>   File
>>> "/opt/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
>>> line 85, in get_system_username
>>> return getpass.getuser().decode(locale.getdefaultlocale()[1])
>>>   File "/opt/local/lib/python2.7/locale.py", line 503, in
>>> getdefaultlocale
>>> return _parse_localename(localename)
>>>   File "/opt/local/lib/python2.7/locale.py", line 435, in
>>> _parse_localename
>>> raise ValueError, 'unknown locale: %s' % localename
>>> ValueError: unknown locale: UTF-8
>>>
>>>
>>> # echo $LANG
>>> # en_US.UTF-8
>>>
>>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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 would I go about building an API converter?

2012-05-02 Thread Nevio Vesic
If I'd go with it, I'd probably go with writing my own simple interface or 
using https://bitbucket.org/jespern/django-piston/wiki/Home
I'm not so big fan of TastyPie at all

On Wednesday, May 2, 2012 11:16:46 AM UTC+2, Alec Taylor wrote:
>
> I have multiple different APIs with different schemas serialised in XML or 
> JSON which I need to output as a standardised schema.
>
> Main features needed:
>
>- *Serialisation to XML and JSON*
>- *Authentication* 
>   - I.e.: can't get/set data unless you have the correct user+pass
>- *Role/Scope limitation* 
>   - I.e.: you can't access everything in our database, only what your 
>   role allows for
>- *Get/set (conversion) between different schemas* 
>   - I.e.: No matter the input API, you can get it formatted in 
>   whichever output API you request
>
> Is this the sort of problem Slumber  with 
> TastyPiewould be best for?
>
> Or are there a different libraries you'd recommend?
>
> Thanks for all suggestions,
>
> Alec Taylor
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/4Ug5RBVF6fsJ.
To post to this group, send email to django-users@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.



app_label of model exception

2012-05-02 Thread 方何
hello everybody,

i get a exception when i use an model which create form
database(http://djangodays.com/2008/07/07/tip-create-modelspy-from-existing-database/)

exception:
IndexError at /users
list index out of range

code:
kwargs = {"app_label": model_module.__name__.split('.')[-2]}

someone says i shoud setup the app_label,
but i don't know can i setup the app_label.


thank you!

--
---
致礼

何方 cnhef...@gmail.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-users@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.



Access specific ModelForm field option within array of ModelForms for use with .js

2012-05-02 Thread jondykeman
Hello, 

I have the following situation:

I am rendering an array of ModelForms to my template. ie. formArray = 
[, , ]

In the template I display the forms with the following:

{% for form in formArray %}

{{ form }}

{% endfor %}

Previously I have accessed certain ModelForms using {% if forloop.counter 
== # %} to add some customization.

However, now I would like more detailed control of certain field tags 
within a given ModelForm. ie. ModelForm2 is a RadioSelect, and I would like 
to add an onChange="some function" to one of the Radio Buttons within this 
ModelForm. 

Is there a way to access this specific field in my implementation directly? 
Or, through the use of a custom template filter?

To give the larger picture my goal is to have an "Other" RadioButton that 
when selected shows a Other text input using javascript, but while using 
ModelForms.

As such, if there is an entirely different way to going about this I would 
love to hear it. 

Any help would be greatly appreciated!


JD



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/OVPO5oqiXc4J.
To post to this group, send email to django-users@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.



TabularInline Image js bug when adding

2012-05-02 Thread jean polo
hello,
just upgrade to 1.4 and I have a weird problem in the admin (therefore the 
weird post title...):

I use TabularInline Image fields in my admin.

the problem is when I click on "Add an object Image", the new field get 
inserted *before* the latest one and therefore its id is wrong and the 
Images do not get saved.
I guess it's easier to understand with a screenshot: 
http://www.yvanvolochine.com/media/images/djangoBUG.gif

the weirdest thing is that the problem only happens online and not locally.
the only difference seems to be that in production, the *.min.js versions 
of the js files are used. I hacked around and replaced them with mine (non 
*.min) but the problem persists...

any hints on where to find where this weirdness come from are very welcome !

_j

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/6_PDzLfUXA4J.
To post to this group, send email to django-users@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: Modify __unicode__

2012-05-02 Thread Masklinn

On 2012-05-02, at 12:46 , Nikhil Verma wrote:

> Hi All
> 
> In models.py my table structure is :-
> 
> class ABC(models.Model):
>name = models.CharField(max_length=80,blank=True,null=True)
>date_created = models.DateTimeField(blank=True,null=True)
> 
>def __unicode__(self):
>return "%s %s" % (self.name, self.date_created)
> 
> 
> Let say my first entry is :-
> name = django
> date_created = 2012-05-02 # it will look like this datetime.datetime(2012,
> 5, 2, 15, 42, 24)
> 
> I want to modify this ABC(__unicode__ method)  object in such a way that
> whenever i call this object from forms
> like this :-
> 
> forms.py
> 
> efg = forms.ModelChoiceField(queryset= ABC.objects.all())
> 
> The dropdown created above should have values like this:-
> 
> 1) django Wednesday PM 2 May # Modify dateTimeField which retuen day of
> week AM or PM and then day and name of month
> 2) django1 Wednesday PM 2 May
> .
> .
> .
> .
> and so on ..
> 
> How can i modify the __unicode__ method to achieve this ?

A DateTimeField maps to a Python datetime object[0], so… just call strftime[1] 
with whatever format parameters you need on "self.date_created" before
interpolating it into the result string?

Also `__unicode__` should return a unicode object[2], with your current
implementation Python will call `str.decode('ascii')`, which will blow up
if your name or your formatted date string contain any non-ascii character
(because it's August in French — août — or March in German — März — or
October in Thai — ตุลาคม, for instance).

[0] http://docs.python.org/library/datetime.html#datetime-objects
[1] http://docs.python.org/library/datetime.html#datetime.datetime.strftime
[2] http://docs.python.org/reference/datamodel.html#object.__unicode__
[3] http://docs.python.org/library/stdtypes.html?highlight=decode#str.decode
  technically it calls something similar to 
`str.decode(sys.getdefaultencoding())`,
  but in Python 2 the default encoding is ascii

PS: I'd suggest learning about Python a bit, Django stands on the shoulders of
a giant, not alone.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Modify __unicode__

2012-05-02 Thread Alexandr Aibulatov
Use in __unicode__ method strftime

     def __unicode__(self):
     return "%s %s" % (self.name, self.date_created.strftime("%A %d %B")

Look at strftime:
http://docs.python.org/library/datetime.html?highlight=strftime#datetime.date.strftime

2012/5/2 Nikhil Verma :
> Hi All
>
> In models.py my table structure is :-
>
> class ABC(models.Model):
>     name = models.CharField(max_length=80,blank=True,null=True)
>     date_created = models.DateTimeField(blank=True,null=True)
>
>     def __unicode__(self):
>     return "%s %s" % (self.name, self.date_created)
>
>
> Let say my first entry is :-
> name = django
> date_created = 2012-05-02 # it will look like this datetime.datetime(2012,
> 5, 2, 15, 42, 24)
>
> I want to modify this ABC(__unicode__ method)  object in such a way that
> whenever i call this object from forms
> like this :-
>
> forms.py
>
> efg = forms.ModelChoiceField(queryset= ABC.objects.all())
>
> The dropdown created above should have values like this:-
>
> 1) django Wednesday PM 2 May # Modify dateTimeField which retuen day of
> week AM or PM and then day and name of month
> 2) django1 Wednesday PM 2 May
> .
> .
> .
> .
> and so on ..
>
> How can i modify the __unicode__ method to achieve this ?
>
> If there is other ways to achieve this that involves changing the table
> structure i won't mind.
>
> Thanks
>
>
>
> --
> Regards
> Nikhil Verma
> +91-958-273-3156
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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-users@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.



Modify __unicode__

2012-05-02 Thread Nikhil Verma
Hi All

In models.py my table structure is :-

class ABC(models.Model):
name = models.CharField(max_length=80,blank=True,null=True)
date_created = models.DateTimeField(blank=True,null=True)

def __unicode__(self):
return "%s %s" % (self.name, self.date_created)


Let say my first entry is :-
name = django
date_created = 2012-05-02 # it will look like this datetime.datetime(2012,
5, 2, 15, 42, 24)

I want to modify this ABC(__unicode__ method)  object in such a way that
whenever i call this object from forms
like this :-

forms.py

efg = forms.ModelChoiceField(queryset= ABC.objects.all())

The dropdown created above should have values like this:-

1) django Wednesday PM 2 May # Modify dateTimeField which retuen day of
week AM or PM and then day and name of month
2) django1 Wednesday PM 2 May
.
.
.
.
and so on ..

How can i modify the __unicode__ method to achieve this ?

If there is other ways to achieve this that involves changing the table
structure i won't mind.

Thanks



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: cPanel Python/Django support

2012-05-02 Thread Gabriel - Iulian Dumbrava
Unfortunately to make it more useful to deploy django, some hosting 
providers should stop providing CentOS with Python 2.4. I just got another 
server with this flavour and I had to install my own version of Python.

Come on, it's 2012!!!

Gabriel


luni, 30 aprilie 2012, 21:24:36 UTC+3, shacker a scris:
>
> For the past couple of years, cPanel (the most widely deployed hosting 
> control panel system) has been taking pulse on user demand for native 
> Django support (similar to their Rails installer). Just saw this note from 
> cPanel devs  and thought some folks here might be interested. This is a 
> great opportunity to help shape the future of what could become one of the 
> most widely available routes to Django deployment on commodity hosting. 
>
> ./s 
>
> Begin forwarded message: 
> > 
> > Dear shacker23, 
> > 
> > cPanelDavidG has just replied to a thread you have subscribed to 
> entitled - After EA3 Django support [Case 33011] - in the Feature Requests 
> for cPanel/WHM forum of cPanel Forums. 
> > 
> > This thread is located at: 
> > 
> http://forums.cpanel.net/f145/django-support-case-33011-a-146541-new-post.html
>  
> > 
> > Here is the message that has just been posted: 
> > *** 
> > For those who are not aware, we are soliciting feedback regarding a 
> preferred Python implementation via a new mailing list devoted specifically 
> for this subject.  If you want to participate, you can visit: cPanel (
> http://go.cpanel.net/python) 
> > *** 
> > 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/DSpJtb_HCnYJ.
To post to this group, send email to django-users@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: Port Django to Javascript

2012-05-02 Thread N.Aleksandrenko
Why do you want to port django to javascript, there are great js libs
and frameworks. It will be better to make a js bundle for django
making in ajax ready.
Js Tools working out of the box. Such as:
+ ajax upload
+ ajax registration with error handeling
+ ajax pages
+ binding django and a js framework (as backbone)
+ bind django with ad ui library (as jquery ui)

and much more basic stuff

Building the apps with django is still not DRY. If you are a frontend
developer you can make a bundle to make django better and many people
may find it helpfull and use it.
If you decide to start such project ... call :) me i can i will help
with ideas and code.



On Wed, May 2, 2012 at 11:51 AM, Gerald Klein  wrote:
> Maybe I missed an earlier post but I am always looking for new projects
> please explain your requirements.
>
> --jerry
>
>
> On Wed, May 2, 2012 at 2:15 AM, DvD  wrote:
>>
>> Hey,
>> is no one is really interested in helping in this project?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/kQ_GesNzV7wJ.
>> To post to this group, send email to django-users@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.
>
>
>
>
> --
>
> Gerald Klein DBA
>
> contac...@geraldklein.com
>
> www.geraldklein.com
>
> j...@zognet.com
>
> 708-599-0352
>
>
> Linux registered user #548580
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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-users@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 would I go about building an API converter?

2012-05-02 Thread Alec Taylor
I have multiple different APIs with different schemas serialised in XML or
JSON which I need to output as a standardised schema.

Main features needed:

   - *Serialisation to XML and JSON*
   - *Authentication*
  - I.e.: can't get/set data unless you have the correct user+pass
   - *Role/Scope limitation*
  - I.e.: you can't access everything in our database, only what your
  role allows for
   - *Get/set (conversion) between different schemas*
  - I.e.: No matter the input API, you can get it formatted in
  whichever output API you request

Is this the sort of problem Slumber  with
TastyPiewould be best for?

Or are there a different libraries you'd recommend?

Thanks for all suggestions,

Alec Taylor

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: DatabaseError when running unit tests after upgrade to Django 1.3.1

2012-05-02 Thread Simon Bächler
Yes, exactly the same here. Even creating the table in setUp doesn't help.

Regards
Simon


> Did anybody experience something similar? 
>
> Cheers, 
> Flo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/luXD0QXI12IJ.
To post to this group, send email to django-users@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's DecimalField represenation in admin as 0,00 values

2012-05-02 Thread orschiro
I want to represent a price in my model in the form of 0,00. This is
the part of my model.

price = models.DecimalField(max_digits=5, decimal_places=2,
default=Decimal('0.00'))

However, prices such as 2.10 are still represented as 2.1.

The second issue would be to replace the . with a ,. However
default=Decimal('0,00') of course is not possible since , is not a
valid literal for Decimal.

Any ideas?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Port Django to Javascript

2012-05-02 Thread Gerald Klein
Maybe I missed an earlier post but I am always looking for new projects
please explain your requirements.

--jerry

On Wed, May 2, 2012 at 2:15 AM, DvD  wrote:

> Hey,
> is no one is really interested in helping in this project?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/kQ_GesNzV7wJ.
> To post to this group, send email to django-users@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.
>



-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

j...@zognet.com

708-599-0352


Linux registered user #548580

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



Multiple databases or Redis/Stats/Graphite/Loggly

2012-05-02 Thread Jean-Mark
Hi all,
 I'm working on an app that will store gps coordinates from devices. That 
information will come in every 5 or so minutes of each hour. So it's alot 
of data. Any recommendations on how I should store this? Do I use multiple 
databases and use say MongoDB or Couch for the storage of the points or do 
I use a solution like Redis / Graphite/Stats or Loggly?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/bzE4dTWSdB0J.
To post to this group, send email to django-users@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: Port Django to Javascript

2012-05-02 Thread DvD
Hey,
is no one is really interested in helping in this project?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/kQ_GesNzV7wJ.
To post to this group, send email to django-users@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.



i18n - local translation does not show up - bug

2012-05-02 Thread kenneth gonsalves
hi,

I want two languages in my project - en and ta. I have set this up in
many projects over the years and this is the first time I am seeing
failure. The problem is that on switching to tamil, the django strings
are getting translated, but not the local strings. Django is obviously
not finding my local .mo file. Makemessages and compilemessages work
fine. My locale directory is at the same level as manage.py. Even if I
put it at the same level as settings.py, it still does not work. 

django version - latest trunk

later: on checking, this works upto revision 17860 and breaks from 17861
-- 
regards
Kenneth Gonsalves

-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.