Search Results

Search found 3 results on 1 pages for 'rxin'.

Page 1/1 | 1 

  • django admin app error (Model with property field): global name 'full_name' is not defined

    - by rxin
    This is my model: class Author(models.Model): first_name = models.CharField(max_length=200) last_name = models.CharField(max_length=200) middle_name = models.CharField(max_length=200, blank=True) def __unicode__(self): return full_name def _get_full_name(self): "Returns the person's full name." if self.middle_name == '': return "%s %s" % (self.first_name, self.last_name) else: return "%s %s %s" % (self.first_name, self.middle_name, self.last_name) full_name = property(_get_full_name) Everything is fine except when I go into admin interface, I see TemplateSyntaxError at /bibbase2/admin/bibbase2/author/ Caught an exception while rendering: global name 'full_name' is not defined It seems like the built-in admin app doesn't work with a property field. Is there something wrong with my code?

    Read the article

  • auto indent in vim string replacement new line?

    - by rxin
    I'm using the following command to auto replace some code (adding a new code segment after an existing segment) %s/my_pattern/\0, \r some_other_text_i_want_to_insert/ The problem is that with the \r, some_other_text_i_want_to_insert gets inserted right after the new line: mycode( some_random_text my_pattern ) would become mycode( some_random_text my_pattern some_other_text_i_want_to_insert <--- this line is NOT indented ) instead of mycode( some_random_text my_pattern some_other_text_i_want_to_insert <--- this line is now indented ) i.e. the new inserted line is not indented. Is there any option in vim or trick that I can make the newly inserted line indented? Thanks.

    Read the article

  • How to represent "{{" in a django template?

    - by rxin
    I'm trying to output in bibtex format in Django and the template looks like this: @{{ pubentry.type }{, author = {{% for author in pubentry.authors.all %}{{ author.first_name }} {{ author.middle_name }} {{ author.last_name }}{% if not forloop.last %} and {% endif %} {% endfor %}}, title = {{{ pubentry.title }}}, journal = {{{ pubentry.journal }}} } The problem is with the "{{{" or "{{%". One way to go around the problem is to add a space after the first "{", but that kind of tamper the format. What's the right way to escape { in Django templates?

    Read the article

1