optional fields in django models

I have the following model in django.

class Link(models.Model):
    name = models.CharField(max_length=100)
    url = models.CharField(max_length=100)
    tag = models.CharField(max_length=100)

    def __unicode__(self):
        return self.name

I need the url field to be optional. How do I do this?

Answers


Add the attribute blank=True. Optionally, you can also make the field NULLable with null=True.


Need Your Help

What could C/C++ “lose” if they defined a standard ABI?

c++ c standards abi

The title says everything. I am talking about C/C++ specifically, because both consider this as "implementation issue". I think, defining a standard interface can ease building a module system on t...

Parse this JSON

objective-c xcode json ios5

I got a small problem with parsing this JSON