it will be whatever you want,
you don't actually need to define it but the default implementation is not
very useful, but you can override so it behaves like you need
it can show manufacturer+' '+serial, or only one or the other, or even a
constant unrelated string like 'Hello mom!'

good luck


On Thu, Jan 9, 2014 at 1:03 AM, Igor Korot <ikoro...@gmail.com> wrote:

> Hi, ALL,
> In the tutorial it is said that I need to create __unicode__() function to
> properly display the results of my model.
> Unfortunately the tutorial is using only one text field and everywhere I
> looked people are using something related, i.e. first_name+last_name and so
> they can create a tuple.
>
> What if my strings are not related to each other at all?
> For example I might have:
>
> from django.db import models
>
> class Stuff(models.Model):
>      Manufacturer = models.CharField(max_length=100)
>      Serial_number = models.CharField(max_length=20)
>
> manufacturer and serial_number are not related and I don't want them to be
> displayed as one field in the output.
> So what the __unicode__() function will look like in this case?
>
> Thank you.
>
> --
> 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/3cb9594d-718f-424c-9d36-25bce866bf2b%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAFWa6t%2BUnW26B4stah0hS86oqK0x7VXNtE8gVO50tXnTRKX2DA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to