The inline foreign key did not match the parent instance primary key.

2015-05-09 Thread Ajay Kumar
I'm trying to set custom id for my model, *models.py* from django.db import models import uuid def get_ref_id(): ref_id = str(uuid.uuid4())[:11].replace('-','').lower() try: id_exists = Sample.objecsts.get(ref_id = ref_id) get_ref_id() except: return ref_id class Sample(models.Model):

Re: NoReverseMatch at /polls/1/results/

2015-05-09 Thread Daniel Roseman
On Saturday, 9 May 2015 05:05:00 UTC+1, James Schneider wrote: > > I agree that the typo is also an issue and should be fixed, but that > wouldn't result in the OP's error, since reverse() is complaining about a > 'detail' URL specifically. The typo would result in a similar error when > the res

Re: Defining base templates for reusable apps

2015-05-09 Thread Bruno A.
Hi, I've never done it, but I myself want to do a similar thing, so I've been thinking about it a bit. The solutions I've thought of are the following: - Template inheritance, as you mention. You provide the base template, but it might not be straightforward for the app's user to override

Two types of users, how would I authenticate them?

2015-05-09 Thread charles javelona
Hi there, I am a newbie in Django. My goal is to create an online platform exchange for my community that helps students like me get part-time jobs from employers. For the past days, I taught myself how to build a blog and the polls app, but it seems what I am building is more complex than a r

Re: Two types of users, how would I authenticate them?

2015-05-09 Thread Tom Evans
On Sat, May 9, 2015 at 4:10 AM, charles javelona wrote: > Hi there, > > I am a newbie in Django. My goal is to create an online platform exchange > for my community that helps students like me get part-time jobs from > employers. > For the past days, I taught myself how to build a blog and the pol

Re: Two types of users, how would I authenticate them?

2015-05-09 Thread Tim Chase
On 2015-05-09 15:52, Tom Evans wrote: > I would simplify things, have just one type of user, who can be > associated with 1:N companies and 1:N schools. A user is an employer > if they are associated with at least one company, and a user is a > student if they are associated with at least one schoo

Re: Two types of users, how would I authenticate them?

2015-05-09 Thread Tom Evans
On Sat, May 9, 2015 at 4:15 PM, Tim Chase wrote: > Since people can attend multiple schools and work for multiple > employers, you can just make it a many-to-many, using the stock > auth User: > > from django.contrib.auth.models import User > > class Company(models.Model): > ... > > clas

Re: NoReverseMatch at /polls/1/results/

2015-05-09 Thread James Schneider
> > I agree that the typo is also an issue and should be fixed, but that >> wouldn't result in the OP's error, since reverse() is complaining about a >> 'detail' URL specifically. The typo would result in a similar error when >> the result page is displayed, and would show 'guestion' as one of the