开发者

Django inlines working on Dev server, yet not on Apache Test server?

开发者 https://www.devze.com 2023-03-17 00:45 出处:网络
I\'m having an issue where the Inline Admin functionality is behaving differently in different environments.

I'm having an issue where the Inline Admin functionality is behaving differently in different environments.

In Dev, when editing a technology I get a link at the bottom to add more Roll Modifiers as needed that works flawlessly.

In Test, I get a single roll modifier with no link to add more and it silently fails to save any changes I make to the roll modifier.

The same code is deployed to both environments. Any ideas what might be going on here?

Dev Server Configuration (actually a Desktop)

  • Gentoo Linux
  • Django 1.3
  • SQLLite3 Database (locally stored)
  • Django built-in development server
  • Python 2.6.6

Test Server Configuration

  • SuSE Linux 11.4
  • Django 1.3 (also tried with Django 1.2.5)
  • PostgreSQL 9.0.3
  • Apache2 2.2.17
  • Python 2.7

Appendix A - Model Code

class Technology(models.Model):
  categories = (
     ('weap' , 'Weaponry'),
     ('equip', 'Equipment'),
     ('cons' , 'Construction'),
     ('ammo' , 'Ammunition'),
   )

  name = models.CharField(max_length=40)
  category = models.CharField(max_length=8, choices=categories)
  urlname = models.CharField(max_length=20)
  description = models.TextField()
  base_difficulty = models.IntegerField()
  tier = models.IntegerField()
  show = models.BooleanField()

  def __unicode__(self):
    return self.name

class TechnologyRollModifier(models.Model):
  technology = models.ForeignKey(Technology)
  modifier   = models.IntegerField(default=2)
  condition  = models.CharField(max_length=120)

Appendix B - Admin Code

from django.c开发者_Go百科ontrib import admin
from solaris.warbook import models

class TechnologyRollModifierInline(admin.StackedInline):
  model = models.TechnologyRollModifier
  extra = 0

class TechnologyAdmin(admin.ModelAdmin):
  fields = ['name', 'urlname', 'description', 'tier', 'category', 'base_difficulty', 'show']
  inlines = [TechnologyRollModifierInline,]

admin.site.register(models.Technology, TechnologyAdmin)


Figured it out. Some time ago I'd copied the Django admin files to /var/www/media/admin and aliases /media/ to /var/www/media/

Which means it was serving up the old media files - giving me working CSS / images but silently failing to find the JavaScript - which the StackedInline admin interface relies upon to do its work.

The single TechnologyRollModifier I saw was meant to be the hidden template and did not actually record any data meant to be entered into it.

Another mystery solved....

0

精彩评论

暂无评论...
验证码 换一张
取 消