How to create Models in Django that act like a CMS? - django

I need help developing models in Django's ORM that would give me the ability to create a user profile and then create unique pages under that user. What I am thinking so far is that I have one model called users and then another model pages. When the user is created and that user creates a page the data in both models are linked by a unique id. Is this the right direction to go or is there a more standard way of doing something like this? Essentially, what I am trying to create is a really stripped down version of Wordpress if that helps.
Any advice would be greatly appreciated.
Thank you

Related

What is the relationship with the variable user in Django with the User model?

I've noticed throughout my time studying Django that when I want to reference a users attributes I can do so by saying something like user.username etc. Obviously my assumption thus far has been that this variable "user" referencing the User model in Django but I haven't been able to find it anywhere officially. Can someone verify this to me so I can put this thought behind me?
Thank you!
You can find the default User model provided by Django in (your python environment)
django.contrib.auth.models
otherwise you can customize your User model like so

How do I take user input and then sum/add to the database in django

I am trying to get the user input and add to the database.
Example:
A user is going to type an integer, then this is to be added to the current value in the database. It's like sending money to someone via online banking.
Assuming you want to use Django's ORM, you will need to define a model. In your model you will have fields that define the data items to store. After you've had Django's manage.py tool setup the database, you can create instances of your model saving them with the save method of your model instance.
This probably seems like a lot of hand waving, and it is. What you should do is work through the Django tutorial as it will answer your questions. The tutorial is at the Django documentation site.

How to save frontend user login/registeration intomation in django project

Am new to django. Any one could suggest me, How to handle frontend user in django project. Such as how and where to save frontend information like first name, last name, email id. Should i create new table in db or save this infomation in admin user table.
Sorry for me bad english.
Thanks.
The base user model can handle this. Docs here. It also comes with some useful built-in forms to help users register - docs here.

Django admin - how to store references to models in model field?

I'm making some big changes in Django Admin and need to make an application to group various models to groups and then show it in menu.
I have a function to generate list of all available admin models including permissions.
So I make 1 model to add group (id, name). Via Inlines I want to add specific models to groups.
What is the best way to store models references? Should I store it as string and during my menu is generated I should parse the name, find specific model and generate its url in admin?
Thanks for clues.
Sounds like contenttypes would help you.

create an object using the form django

Thank you for looking into this!
I doing one of those django tutorials from their official website, creating a poll. The poll app and everything is working.
The problem is that after I have created authentication for the users to log in they should be able to create the polls, aka they're given the fields with questions/choices, fil it in and from that data(form) it should a new poll object into the db. I have set up everything, but I cannot figure out how do I write the view for this, as in how do I extract data from the form and add it all as a new poll.
I am using three models, as in tutorial: polls, choices and user (user isn't recognisable either, i mean in the model 'user' i have a variable name = models.ForeignKey(User), I was using django-registration to register the them, but that's not the main problem at the moment).
I hope I am more or less clear, if not, I will be glad to explain again:)
thanks, blargie-bla
I'd recommend you starting with generic views.
https://docs.djangoproject.com/en/1.3/topics/class-based-views/#decorating-class-based-views
https://docs.djangoproject.com/en/1.3/ref/class-based-views/#editing-views