How can I create one model that can takes all these models to look exactly like Microsoft Access Design View?
class Numbers(models.Model):
num = models.IntegerField()
class Characters(models.Model):
char = models.CharField(max_length=1000)
class Check(models.Model):
check = models.BooleanField()
class Date(models.Model):
date = models.DateField()
class LargeNumber(models.Model):
larger_num = models.DecimalField(max_digits=30 decimal_places=15)
class TablesDesign(model.Models):
""""
I want to put all these models into the TablesDesign
model to create something similar to Microsoft Access Design View.
Couple of thoughts here -
-
You don’t put models in models. Models contain fields, not models. You can create Models with any desired combinations of fields.
-
The structure of a model has absolutely nothing to do with the UI that you create from those models. There is nothing that you do with your model structure that is going to create or inhibit the user interface that you want to create. They are two separate and distinct issues.
If I make the TablesDesign
model like this:
Class TablesDesign(models.Model):
number = models.IntegerField()
character = models.CharField(max_length=1000)
check = models.BooleanField()
date = models.DateField()
larger_number = models.DecimalField(max_digits=30 decimal_places=15)
How can I allow user to structure the data type the way he wants,
?
I want to create design view Table similar to Microsoft Access Design View, I want to allow user to create a design first, and then allowing him to add an object based on a giving Field and data type.
In other words, are you looking to allow a user to dynamically add or modify models to your project? Or are you looking to create an “Inner Platform” system?
If the former, I hope you realize that there are a lot of significant issues that need to be addressed when trying to do something like that.
Fundamentally, Django is not designed to allow or provide for schema modifications in a running system. These types of changes would need to be made and then implemented with the site down. This type of operation then needs to be performed “outside” of Django itself, where you can run makemigrations
and migrate
without interference from the site being up.
1 Like
I want to create Inner Platform system in django sir.
Then your first step would be to design the inner platform architecture. There are a lot of questions that would need to be answered before you can even begin creating your data models.
Note: The following are rhetorical questions. This forum is not suitable for a full discussion of these items. Do not bother answering them here. But, you need to have answers for them before you can productively proceed.
What is this system going to do?
What functionality do you need to provide to the users?
How are you going to store the data definitions?
How are you going to store the functionality?
How is that functionality going to be performed by the system?
Once you understand all these issues, then you can start to design your models to support those functions.
1 Like