That's fine...well for data types ad a field for types say an integer field
and when youcome across a new type you need just increment your integer
count by one...

ie:

STRING = 1
INT = 2
CHAR = 3
TYPE_CHOICES = (
(STRING, 'string'),
(INT, 'integer'),
(CHAR, 'character'),
)

Then add the field to your model:
data_type = models.IntegerField(choices=TYPE_CHOICES)

Then in your admin view there will be filds the user needs to fill 'in'

name
value
type

I understand your lack of depth of information on the topic (this solution
isn't making me any happier than it's making you! :)

I'm sure there is a slicker solution out there, I'm just trying to give you
something to think about and hopfully come up with something more elegant
that fits your business needs! :)

n

On Mon, Sep 13, 2010 at 4:37 AM, pixelcowboy <pixelcowbo...@gmail.com>wrote:

> Of course! But what about different field types? How would you pair
> the variable name with the variable value for multiple types in the
> same class?  Or would you need a separate model class for each
> different value type? example integers, strings, etc
>
> Sorry for the lack of information, but my application structure
> requires that users are able to add arbitrary variables to a
> model.Thanks for your help!
>
> On Sep 12, 8:24 pm, "nick.l...@gmail.com" <nick.l...@gmail.com> wrote:
> > without knowing any context of what you want...or are going to do...I
> would
> > say create a similar model and run with it:
> >
> > class UserVariables(models.Model):
> >     variable_name = models.CharField(max_length=100)
> >     variable_value = models.TextField()
> >
> > THOUGH like I said, I have no idea what you're trying to do or why...but
> > this is by far the simplest way :)
> >
> > n
> >
> > On Sun, Sep 12, 2010 at 9:42 PM, pixelcowboy <pixelcowbo...@gmail.com
> >wrote:
> >
> > > What would be the best way to enable a user to create arbitrary
> > > variables through the django admin? This could be either numbers, text
> > > or paths to files.  Thanks for your advice!
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> <django-users%2bunsubscr...@google groups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
> >
> > --
> > Guadajuko! Vamos a correr!
> >  -"Cool! we are going to run!"
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Guadajuko! Vamos a correr!
 -"Cool! we are going to run!"

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to