Re: cleaned_data returning empty in formsets

2013-04-08 Thread Nora Olsen
Just found the culprit: 'form-INITIAL_FORMS': u'1', it must be 2. On Tuesday, April 9, 2013 1:09:10 PM UTC+8, Nora Olsen wrote: > > > The following snippet is returning an empty dictionary for the 2nd form: > > > >> dct = {'form-0-attachment': u'', >> 'form-0-id': u'1', >> 'form-0-name':

cleaned_data returning empty in formsets

2013-04-08 Thread Nora Olsen
The following snippet is returning an empty dictionary for the 2nd form: > dct = {'form-0-attachment': u'', > 'form-0-id': u'1', > 'form-0-name': u'1', > 'form-1-attachment': u'', > 'form-1-id': u'2', > 'form-1-name': u'2', > 'form-INITIAL_FORMS': u'1', > 'form-MAX_NUM_FORMS': u'1000',

Re: Deploying: Desktop to server

2013-04-08 Thread Tim Johnson
* Shawn Milochik [130408 16:41]: > It should be fine, unless you're using encrypted fields, using the > SECRET_KEY setting as the key, and have a different key in production. > > Of course, if you want to keep the databases in sync after that, that's > another issue.

Re: Accessing list of dictionaries in jQuery

2013-04-08 Thread Nikolas Stevenson-Molnar
Injecting data into client code is bound the be kludgy any way you slice it. The reason for passing it through a hidden element has to do with correct escaping of characters. Consider the following: $.parseJSON("{{ images_as_json }}"); and lets say this is rendered as: $.parseJSON("{foo:

Re: Deploying: Desktop to server

2013-04-08 Thread Shawn Milochik
It should be fine, unless you're using encrypted fields, using the SECRET_KEY setting as the key, and have a different key in production. Of course, if you want to keep the databases in sync after that, that's another issue. On Apr 8, 2013 5:09 PM, "Tim Johnson" wrote: > FYI

Re: Accessing list of dictionaries in jQuery

2013-04-08 Thread Larry Martell
I appreciate the suggestion, but using a hidden field sounds very kludgy. Is there no other way? On Mon, Apr 8, 2013 at 6:01 PM, Nikolas Stevenson-Molnar wrote: > Injecting data into a template can be tricky. I would recommend doing > two things: > > 1) Serialize your

Deploying: Desktop to server

2013-04-08 Thread Tim Johnson
FYI - I'm new to django, but have been doing web programming since '96 and python since '03. I intend to put together a test site on my desktop and push it to a remote server. I will be the only user making changes to this site. Thus I presume that it is OK to push the database as well. Am I

Re: Accessing list of dictionaries in jQuery

2013-04-08 Thread Nikolas Stevenson-Molnar
Injecting data into a template can be tricky. I would recommend doing two things: 1) Serialize your data to JSON in your view first using Python's json module. Something like this: >>> images_as_json = json.dumps(images) 2) Rather than trying to inject it directly into JavaScript, which can

Accessing list of dictionaries in jQuery

2013-04-08 Thread Larry Martell
I am passing a list of dictionaries to my template. In the template language I can do this and it works as expected: {% for row in images %} {% endfor %} But I need to process this data in jQuery. If I pass images into a function like this: my_func({{ images

Re: How to rename objects (Urgent)

2013-04-08 Thread Giorgos Kontogiorgakis
Hi Serdar! Yeah,i mean django admin by webinterface!I didn't created the spessific table,i already had a legacy database running.For example i have the next code for 1 of my tables in models.py: class Links(models.Model): interfacein = models.CharField(max_length=20L,

Re: Understanding UpdateView with forms and formsets

2013-04-08 Thread Rainy
Sorry, I answered before reading your full message. It looks like you understand post loads the object in get_object(). I just want to add that combined create/update can be done in different ways; I have an implementation in mcbv.edit module but I'm not sure if it's the best approach in all

Re: Creating a admin-field, containing checkboxes. The data of this fields is stored in the string format

2013-04-08 Thread Sam Solomon
Not sure exactly what the issue is, but this may be handy (either as a replacement or as an example of doing something somewhat similar): https://github.com/disqus/django-bitfield I believe on most machines the maximum is 63 "flags" though so you will likely only be able to use it as an

Re: Understanding UpdateView with forms and formsets

2013-04-08 Thread Rainy
On Monday, April 8, 2013 12:22:34 PM UTC-4, Nora Olsen wrote: > > Hi, > > I'm a new user to Django. > > I'm trying to understand how does an UpdateView works when during a POST. > Is there some state carried between the GET and POST, because I don't see > the pk in the form. How does the

Re: How to rename objects (Urgent)

2013-04-08 Thread Serdar Dalgic
On Mon, Apr 8, 2013 at 7:26 PM, Giorgos Kontogiorgakis wrote: > Hi there guys!I have an answer about renaming objects on my webinterface.For > example i have a table named "Map" and i have many obejcts in there(Map > object,Map object,Map object,Map object,Map object,Map

Understanding UpdateView with forms and formsets

2013-04-08 Thread Nora Olsen
Hi, I'm a new user to Django. I'm trying to understand how does an UpdateView works when during a POST. Is there some state carried between the GET and POST, because I don't see the pk in the form. How does the form save() knows that it should be updating instead of inserting? The reason

How to rename objects (Urgent)

2013-04-08 Thread Giorgos Kontogiorgakis
Hi there guys!I have an answer about renaming objects on my webinterface.For example i have a table named "Map" and i have many obejcts in there(Map object,Map object,Map object,Map object,Map object,Map object) How is it possible to rename them?I mean i want to have something like (Map

Re: Why is a username required for a User?

2013-04-08 Thread Tom Evans
On Mon, Apr 8, 2013 at 4:49 PM, Cody Scott wrote: > Yes I am using Django 1.5 In 1.5, you can fully customise what fields your User class has. Full notes in the docs: https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#auth-custom-user Cheers Tom -- You

Re: Why is a username required for a User?

2013-04-08 Thread Anderson
You can use BaseUserManager, AbstractBaseUser,PermissionsMixin. here is a exemple: from django.db import models from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager from django.confimport settings class MyUserManager(BaseUserManager): def

Re: Why is a username required for a User?

2013-04-08 Thread Cody Scott
Yes I am using Django 1.5 On Monday, 8 April 2013 11:11:57 UTC-4, Anderson Borges wrote: > > Hey Cody are using django 1.5? > > > On Mon, Apr 8, 2013 at 9:09 AM, Cody Scott > wrote: > >> To create a User object you need to have a unique username. >> >> I would like to use

Re: urgent - how do I tell django to relax required password?

2013-04-08 Thread frocco
Thanks Resolved On Monday, April 8, 2013 11:18:32 AM UTC-4, larry@gmail.com wrote: > > On Mon, Apr 8, 2013 at 9:02 AM, frocco > wrote: > > on registration, login django is asking for uppercase and special chars > for > > password. > > how do I tell django to allow

Re: [SPAM] Implementing User login expiration

2013-04-08 Thread John DeRosa
On Apr 5, 2013, at 5:33 PM, Nikolas Stevenson-Molnar wrote: > How about creating request middleware to sign out deactivated users? > Something like: > > if request.user.profile.expired: >logout(request) > > If you're concerned about the extra database hit per

Re: urgent - how do I tell django to relax required password?

2013-04-08 Thread Larry Martell
On Mon, Apr 8, 2013 at 9:02 AM, frocco wrote: > on registration, login django is asking for uppercase and special chars for > password. > how do I tell django to allow basic passwords? > > My site is live and I am having issues This may help you:

Re: Why is a username required for a User?

2013-04-08 Thread Anderson
Hey Cody are using django 1.5? On Mon, Apr 8, 2013 at 9:09 AM, Cody Scott wrote: > To create a User object you need to have a unique username. > > I would like to use an email and a password to identify users, since an > email is already required for my site's

Why is a username required for a User?

2013-04-08 Thread Cody Scott
To create a User object you need to have a unique username. I would like to use an email and a password to identify users, since an email is already required for my site's functionality. It seems silly for a framework so restrict you. -- You received this message because you are subscribed

urgent - how do I tell django to relax required password?

2013-04-08 Thread frocco
on registration, login django is asking for uppercase and special chars for password. how do I tell django to allow basic passwords? My site is live and I am having issues Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Creating JSON file

2013-04-08 Thread Seth Gordon
You want to output a list of one dict per object, and you want that dict to contain another dict inside it. So you don’t need dict2. Instead f = file('report.json','a+') sys.stdout = f result = [] objects = game_objects.objects.all() for obj in objects: time =

Re: Django Generic ForeignKey vs Multiple Foreign Key Fields

2013-04-08 Thread Javier Guerra Giraldez
On Mon, Apr 8, 2013 at 8:43 AM, Javier Guerra Giraldez wrote: > On Mon, Apr 8, 2013 at 5:34 AM, Arun Prabhakar wrote: >> more can come in the future > > that's reason enough to use Generic relations (of course, much better would be if you can refactor

Re: Django Generic ForeignKey vs Multiple Foreign Key Fields

2013-04-08 Thread Javier Guerra Giraldez
On Mon, Apr 8, 2013 at 5:34 AM, Arun Prabhakar wrote: > more can come in the future that's reason enough to use Generic relations -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

Re: New book: Instant Django 1.5 Application Development Starter

2013-04-08 Thread Mauro Rocco
Thank you On Friday, April 5, 2013 8:27:34 PM UTC+2, megaBos wrote: > > good job -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Creating JSON file

2013-04-08 Thread Nagarajan Dharmar Sitha
saved = sys.stdout f = file('report.json','a+') sys.stdout = f result = [] objects = game_objects.objects.all() for obj in objects: dict2 ={} time = time_stamp.objects.filter(user_id = obj.user_id) obj_id = obj.object_id per =

CSRF verification fails on a specific browser

2013-04-08 Thread Bastian
When I try to log in on a Django project that has been working for some time with Firefox on Ubuntu I get a CSRF verification failure while with other browsers I can log in just fine (Chromium on Ubuntu or Safari on iPad or even another Firefox on MacOS). I have checked in the POST that the

Re: creating resource with django-tastypie

2013-04-08 Thread psychok7
GOT IT WORKING. It was a problem with the default tastypie read only authorization On Monday, April 8, 2013 12:00:35 PM UTC+1, psychok7 wrote: > > it was a quoting problem.. but now i get another error: > > HTTP/1.0 401 UNAUTHORIZED > > curl --dump-header - -H "Content-Type: application/json" -X

Re: Getting an AttributeError while creating a Django project

2013-04-08 Thread Rafael E. Ferrero
I see that u use windows... try with these https://zignar.net/2012/06/17/install-python-on-windows/ first. with virtualenv you can have more control and diferents versions to try without any problem. virtualenv create a virtual machine where you can install django, python, etc to work with, if

Re: creating resource with django-tastypie

2013-04-08 Thread psychok7
it was a quoting problem.. but now i get another error: HTTP/1.0 401 UNAUTHORIZED curl --dump-header - -H "Content-Type: application/json" -X POST --data '{"city": "/api/smart/city/35/", "comment": "teste do php", "id": "4", "resource_uri": "/api/smart/rating/4/", "rating": "3","user_id":

creating resource with django-tastypie

2013-04-08 Thread psychok7
guys i am having problems creating a new resource with django tastypie. i get the following error: class RatingResource(ModelResource): city = fields.ForeignKey(CityResource, 'city') user_id = fields.ForeignKey(UserResource, 'user') class Meta: queryset = Rating.objects.all()

Re: Implementing User login expiration

2013-04-08 Thread Tom Evans
On Sat, Apr 6, 2013 at 12:24 AM, John DeRosa wrote: > I have a Profile table that's 1:1 with the User table. Each Profile row has > an account_expiration field. > > I want to invalidate users when their accounts expire. By "invalidate", I > mean: They can't log in,

Re: Django Generic ForeignKey vs Multiple Foreign Key Fields

2013-04-08 Thread Arun Prabhakar
Hi Martin, A and B are known, and more can come in the future, so it would seem generic is the way to go, but then I dont want to reference on all tables in django. But using the FK has problem of introducing alter tables later. Confused about going with which approach. What do you suggest?

custom logging with keywords

2013-04-08 Thread Gabriel - Iulian Dumbrava
Hi guys, some time ago a post was made on this group (I think) about a custom logger that you can use to easy add log messages with specific keywords that may appear in the admin as a filter. Does any of you know what this package is? I simply can't find the entry anymore. Thanks! Gabriel

Re: Good tutorials on celeryd as a daemon needed?

2013-04-08 Thread Marcos Moyano
http://ask.github.io/celery/cookbook/daemonizing.html On Mon, Apr 8, 2013 at 6:01 AM, sparky wrote: > Hi Django people, > > I'm finding it difficult to get my head around running celeryd as a daemon > from the docs on Ubuntu. Does anyone know of any good tutorials or

Re: Django Generic ForeignKey vs Multiple Foreign Key Fields

2013-04-08 Thread Martin J. Laubach
It's simply a question of what you want to model. *GenericFK* means for each instance "I have a relationship with some other (undefined) entity". *MultipleFK* means "I have relationships with both well-known entities A and B". Totally different things. Cheers, mjl -- You received

Django Generic ForeignKey vs Multiple Foreign Key Fields

2013-04-08 Thread Arun Prabhakar
# I have 2 models, say A and B class A(models.Model): pass class B(models.Model): pass """ Now my query is which of the following would you choose and why? """ class GenericFK(models.Model): content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField()

Good tutorials on celeryd as a daemon needed?

2013-04-08 Thread sparky
Hi Django people, I'm finding it difficult to get my head around running celeryd as a daemon from the docs on Ubuntu. Does anyone know of any good tutorials or reading to help me along? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: How to change the {{ form.as_table }}

2013-04-08 Thread Venkatraman S
Also, do have a look at crispy-forms. -Venkat On Mon, Apr 8, 2013 at 7:59 AM, Ben Carleton wrote: > You can use the label attribute on your form fields to override the > default labels: > > dn = forms.CharField(label="dn") > cv = forms.CharField(label="cv") > > -- Ben > >