Hi Mr. Akumbo, The options for Model Fields that come with django in the django.db library and are listed and explained here: https://docs.djangoproject.com/en/dev/ref/models/fields/#model-field-types
Each corresponds to a different type of data. For example name = models.CharField(max_length=60) just means that the the database will store a 60-character text string (VARCHAR). Other libraries can define other field types. For example, the https://pypi.python.org/pypi/django-localflavor package has Model fields specific to different nations such as localflavor.za.forms.ZAPostCodeField for South African postal codes. If you really need to, you can look at the source code <https://github.com/django/django-localflavor/blob/0dac2721293e9ece827c74ab11aa0255b8062d69/localflavor/za/forms.py> of that project for an example of defining your own. It sounds like you are working through someone else's django project but would find some broader context useful. If you haven't already, I would recommend working through the tutorial, starting here: https://docs.djangoproject.com/en/dev/intro/tutorial01/ best regards, Andrew Farrell On Mon, Jun 2, 2014 at 8:51 PM, ngangsia akumbo <ngang...@gmail.com> wrote: > > > On Sunday, June 1, 2014 7:42:13 PM UTC+1, Thomas wrote: > >> >> On 2014-05-31, at 4:41 AM, ngangsia akumbo <ngan...@gmail.com> wrote: >> >> please i need some legit answer please >> >> >> Please give one or two specific examples of functionality you need. There >> are parameters for fields which can help specialize some behaviours without >> needing a new model. And there are hooks to allow specialization of >> behaviours in interpretation or handling when reading or saving values >> which you may find useful. >> >> afaik there is no large library of model specializations for Django, but >> that may be because there is no clear large set of specializations that >> would be useful. >> >> So give an example please. Is it the book name, the book author, or >> something else which needs extra or restricted behaviours? >> >> - Tom >> >> > This is an example. Where did the get all these parameter like CharField, > DateTimeField etc. > > >> class Item(models.Model): >> name = models.CharField(max_length=60) >> created = models.DateTimeField(auto_now_add=True) >> priority = models.IntegerField(default=0) >> difficulty = models.IntegerField(default=0) >> done = models.BooleanField(default=False) >> class ItemAdmin(admin.ModelAdmin): >> list_display = ["name", "priority", "difficulty", "created", "done"] >> search_fields = ["name"] >> admin.site.register(Item, ItemAdmin) >> >> >> -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/44996582-811d-4731-a8d6-7133a02459b4%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/44996582-811d-4731-a8d6-7133a02459b4%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2By5TLYDLe%2By_yehWr8RG2SGt0V6GLf3GWQyYxAVfJ36fWe8jg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.