views:

35

answers:

2

After finishing the core functionalities of my project it's time to begin with other secundary but important things.

I've something like the following models.py file:

class Category(models.Model):
   name = models.CharField(max_length=30)    

class Transaction(models.Model):
    name = models.CharField(max_length=30)
    description = models.TextField(blank=True)
    amount = models.DecimalField(max_digits=12, decimal_places=2)
    category = models.ForeignKey(Category, related_name='transacciones', blank=True, null=True)

The following is the list of things I'd like to implement:

  • Users registration: create a subdomain for every different user(user.domain.com).

  • Accounts: Each user can create different accounts.Example: the user A have a home account with categories car and house, and a work account with categories salary and bonuses.

  • Different users can access the same subdomain with different permissions(not my priority right now).

I read about different django apps to make this work but I'm very confused about how to integrate them to work fine together. I don't know where to start.

Django-registration: http://bitbucket.org/ubernostrum/django-registration

Django-subdomain: http://github.com/tkaemming/django-subdomains or http://github.com/agiliq/django-subdomain.

Django-accounts: http://code.google.com/p/django-accounts/.

+2  A: 

This question is too vast - it's hard to answer at once not knowing the overall structure of your use case and all of those tiny details. Also doing this integration for you as an example would take too much time and I doubt that someone would have time to spare for it.

Maybe you should try by integrating one app at the time - starting from django-domain, through django-registration and finishing on django-accounts. Also be prepared for some coding - it will not integrate auto-magically.

My advice: start by reading the docs and get know all those apps separately (install them, learn how to use them, read and understand the source code) - it will be much easier for you to further integrate them.

bx2
A: 

About Accounts: I think it can be solved with a ManyToOne field.

class Account(models.Model):
    name = models.CharField(max_length=30)

class Category(models.Model):
    ...
    account = models.ForeignKey(Account)

class Category(models.Model):
    ....
    account = models.ForeignKey(Account)

Am I right or is it something wrong with this?

mxm