Re: Null constraint violations when saving objects with ForeignKey relationships

2013-06-14 Thread kvlulla
Hi Lukasz.. Thanks it was helpful..i was looking for something like this. -Karan On Sunday, December 27, 2009 12:50:05 PM UTC-8, Łukasz Balcerzak wrote: > > Hi there, > > Well, just try to make sure you are passing already saved instance (having > primary key set) > into related model which has

Re: Django confusing issues DRIVING ME MAD. Please someone help?

2013-06-14 Thread sparky
*thanks Nikolas!!!* you help me resolve the issue. no idea why it effects reverse but my log file show an error with some middleware and resloved that issue and for some reason all urls started working again! On Friday, June 14, 2013 6:45:08 PM UTC+1, sparky wrote: > > Hi, I'm wondering if anyon

Re: Django confusing issues DRIVING ME MAD. Please someone help?

2013-06-14 Thread Nikolas Stevenson-Molnar
Ok, so something is happening to the name "reverse" in the global scope between the time you're importing it at the top of the file and when get_absolute_url is called. Search the file for instances of "reverse". Are you importing anything else by that name? Or anything like "import foo as reverse"

Re: Django confusing issues DRIVING ME MAD. Please someone help?

2013-06-14 Thread sparky
Ok I have no idea whats happening, I took your advice and added the code below. then on production get_absolute_url starting working. I took it out and it stopped again. get_delete_url does not work either until I add in your debugging again WTF! def get_absolute_url(self): import l

Re: Django confusing issues DRIVING ME MAD. Please someone help?

2013-06-14 Thread Nikolas Stevenson-Molnar
It's hard to say without having the full source. If the data are different on dev and production, it's possible there's a different execution path, causing a problem on one but not the other. But you can tell it's not an import problem, as that would raise an import error. And it's not a problem wi

Re: Django confusing issues DRIVING ME MAD. Please someone help?

2013-06-14 Thread sparky
Hi Nikolas, - Guessing from the stack trace you provided, either "reverse" or "str" are None (since those are the only two function calls on that line). yes that will be the issue, but why is it none in production and works (has a value) in django server? -- You received this message becaus

Re: Issues saving form data

2013-06-14 Thread Lucas Magnum
Hi Tom, Maybe I can help you. Skype: lmagnum92 []'s Lucas Magnum. 2013/6/14 Tom Russell > I am having some issues saving data from a form and not sure why since it > was working just yesterday. > > Could someone take a look offline to give me some feedback on what I am > doing wrong? It'

Issues saving form data

2013-06-14 Thread Tom Russell
I am having some issues saving data from a form and not sure why since it was working just yesterday. Could someone take a look offline to give me some feedback on what I am doing wrong? It's a small project but this has me stumped. Also, is anyone available via skype to talk in regards to some of

Re: Django confusing issues DRIVING ME MAD. Please someone help?

2013-06-14 Thread Nikolas Stevenson-Molnar
Guessing from the stack trace you provided, either "reverse" or "str" are None (since those are the only two function calls on that line). Is there anywhere you are doing something like reverse = blah or str = blah? Also, you could add a couple of debug statements prior to that call to confirm whic

Django confusing issues DRIVING ME MAD. Please someone help?

2013-06-14 Thread sparky
Hi, I'm wondering if anyone can help me with the following issues it's really confusing me *(and others who have tried to help)* The question is here: http://stackoverflow.com/questions/17113479/django-get-absolute-url-empty-in-production *But the summery is. * I'm using {{ item.get_absolute_u

Re: Django Basics

2013-06-14 Thread Andre Terra
You really *should* use a database, even if you use SQLite just for learning. SQLite saves a .db file to your hard drive, but it's a RDBMS like many other, albeit in simpler form. Take a look at the tutorial[1] and if you have any questions, try googling, asking here or on stackoverflow[2] Cheer

Re: Django-Tastypie and MySQL

2013-06-14 Thread Sithembewena Lloyd Dube
Much better. I don't think that you have to put quotes when you define player_club. Just go, player_club = models.ForeignKey(Club) - you want to pass the Club model, not a string. Regarding the question, if the player can only belong to one club, then a foreignkey relationship is correct because i

Re: Newbie with Demo issues

2013-06-14 Thread Sithembewena Lloyd Dube
Hi Strat, Tom is right - the issue is the name of the view in your template. Reverse takes the name of your view and builds it's url. In this case, you are calling the view 'detail/' (with a trailing slash) instead of 'detail'. Cheers, Lloyd On Fri, Jun 14, 2013 at 3:42 PM, Tom Evans wrote: >

Re: Django-Tastypie and MySQL

2013-06-14 Thread Hélio Miranda
Ok, so what I did was this: Código (Python): class Player(models.Model): player_name = models.CharField(max_length=200) player_age = models.CharField(max_length=200) player_club = models.ForeignKey('Club') class Club(models.Model): club_name = models.CharField(max_length=200) I

Re: Django-Tastypie and MySQL

2013-06-14 Thread Sithembewena Lloyd Dube
I meant, delete the PlayerClub linking table/ model. The foreignkey relationship takes care of that need. On Fri, Jun 14, 2013 at 4:41 PM, Sithembewena Lloyd Dube wrote: > Hey, > > The player belongs to a club. So in the player model you should have > > player_club = models.ForeignKey(Club) > >

Re: User authentication with either username or email.

2013-06-14 Thread Tom Evans
On Fri, Jun 14, 2013 at 3:29 PM, shashank sandela wrote: > As you can see in the views.py I did import the class > EmailOrUsernameModelBackend. OK. But you mustn't import that class, you must allow django to import it itself, and then django will use it when authenticating users. You do this by

Re: Django-Tastypie and MySQL

2013-06-14 Thread Sithembewena Lloyd Dube
Hey, The player belongs to a club. So in the player model you should have player_club = models.ForeignKey(Club) then remove the foreign key in the Club model. Also, notice casing - your variable names should be lowercase and if it's more than one word, join it with underscores. It's Python conve

Re: User authentication with either username or email.

2013-06-14 Thread shashank sandela
Sorry. The error was: AttributeError at /authentication/ 'User' object has no attribute 'backend' -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users

Re: User authentication with either username or email.

2013-06-14 Thread shashank sandela
As you can see in the views.py I did import the class * EmailOrUsernameModelBackend.* * * Now when I used " *user = EmailOrUsernameModelBackend().authenticate(username=username, password=password) *" It gave an error saying: AttributeError at /tangle/auth/ 'User' object has no attribute 'backen

Re: User authentication with either username or email.

2013-06-14 Thread Enyert Viñas
El 14/06/2013 07:26 a.m., shashank sandela escribió: unbound method authenticate() must be called with EmailOrUsernameModelBackend instance as first argument (got nothing instead) Hi. Remember that you must import a function before you call it. This is a reference to authentication in Django h

Re: Newbie with Demo issues

2013-06-14 Thread Tom Evans
On Fri, Jun 14, 2013 at 10:12 AM, Strat Parrott wrote: > > > I have done the tutorial three times and everything is fine up until I get > to Tutorial 3 > https://docs.djangoproject.com/en/1.5/intro/tutorial03/ > > > I must be missing something but at this point I've done it all three times > so I'

Re: User authentication with either username or email.

2013-06-14 Thread Tom Evans
On Fri, Jun 14, 2013 at 12:56 PM, shashank sandela wrote: > Hi, > > I created a backends.py in my project folder. > > backends.py :: > > from django.conf import settings > from django.contrib.auth.models import User > > class EmailOrUsernameModelBackend(object): > def authenticate(self, userna

Re: Using Fabric to clear database records

2013-06-14 Thread Sithembewena Lloyd Dube
Thank you, Avraham. On Fri, Jun 14, 2013 at 2:26 PM, Avraham Serour wrote: > manage.py flush > > > On Fri, Jun 14, 2013 at 3:16 PM, Sithembewena Lloyd Dube < > zebr...@gmail.com> wrote: > >> Greetings, >> >> I've got a Django 1.5.1. project where I have a Video model (basically >> saving video

Re: Django-Tastypie and MySQL

2013-06-14 Thread Hélio Miranda
After reading a bit what I did was the following: Código (Python): from django.db import models class Player(models.Model): #idPlayer = models.AutoField(primary_key=True) PlayerName = models.CharField(max_length=200) PlayerAge = models.CharField(max_length=200) #Clubs = models.ManyT

User authentication with either username or email.

2013-06-14 Thread shashank sandela
Hi, I created a backends.py in my project folder. backends.py :: *from django.conf import settings* *from django.contrib.auth.models import User* * * *class EmailOrUsernameModelBackend(object):* *def authenticate(self, username=None, password=None):* *if '@' in username:* *

Re: Using Fabric to clear database records

2013-06-14 Thread Avraham Serour
manage.py flush On Fri, Jun 14, 2013 at 3:16 PM, Sithembewena Lloyd Dube wrote: > Greetings, > > I've got a Django 1.5.1. project where I have a Video model (basically > saving video metadata). I would like to create a fabfile in my project > folder so that when I run 'fab production refresh', t

Using Fabric to clear database records

2013-06-14 Thread Sithembewena Lloyd Dube
Greetings, I've got a Django 1.5.1. project where I have a Video model (basically saving video metadata). I would like to create a fabfile in my project folder so that when I run 'fab production refresh', the list of videos saved in the production environment (Amazon EC2) should be cleared out and

Re: Django-Tastypie and MySQL

2013-06-14 Thread Sithembewena Lloyd Dube
Hi Hélio, I happen to be using Tastypie for the first time as well and so far, the documentation is comprehensive enough. You could start here: http://django-tastypie.readthedocs.org/en/latest/tutorial.html http://django-tastypie.readthedocs.org/en/latest/cookbook.html http://django-tastypie.read

Django list_filter in Admin

2013-06-14 Thread francescobocca...@libero.it
Hi all, i would like to add in my admin page a custom filter that can allow me to select all user that doesn't belong to none groups. If i add : list_filter = ('groups') it show me a filter in the right part af admin interface: By group All group1 group2 i would like to add : All None (0) gr

display selected item in template using Django

2013-06-14 Thread roopasingh250
PERSON_ACTIONS = ( ('1', '01.Allowed to rest and returned to class'), ('2', '02.Contacted parents /guardians'), ('3', '02a.- Unable to Contact'), ('4', '02b.Unavailable - left message'),) class PersonActionsForm(forms.ModelForm): action = forms.MultipleChoiceField(widget=form