argh, bugfix in model. Minor tweak to template.
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 5 Apr 2009 21:25:54 +0000 (21:25 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 5 Apr 2009 21:25:54 +0000 (21:25 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@280 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/syrup/models.py
conifer/templates/item_add_cat_search.xhtml

index 4258dd6..b0f8574 100644 (file)
@@ -599,13 +599,15 @@ class PhysicalObject(m.Model):
     def save(self, force_insert=False, force_update=False):
         # Must ensure that barcode is unique for non-departed items. Same with smallint
         try:
+            unique_thing = 'barcode'
             already = PhysicalObject.objects.exclude(pk=self.id).get(departed=None)
+            unique_thing = 'smallint'
             if self.smallint:
-                already = PhysicalObject.objects.exclude(pk=self.id).get(smallint=smallint)
+                already = PhysicalObject.objects.exclude(pk=self.id).get(smallint=self.smallint)
         except PhysicalObject.DoesNotExist:
             super(PhysicalObject, self).save(force_insert, force_update)
         else:
-            raise AssertionError, 'barcode is not unique in active PhysicalObject collection.'
+            raise AssertionError, '%s is not unique in active PhysicalObject collection.' % unique_thing
 
     @classmethod
     def by_smallint(cls, smallint):
index b41f1fe..05ddd1c 100644 (file)
@@ -30,7 +30,7 @@ dc_keys = ['dc:title', 'dc:creator', 'dc:publisher', 'dc:date']
       <input type="submit" value="Search"/>
     </form>
 
-    <table class="pagetable">
+    <table class="pagetable" py:if="request.method == 'POST'">
       <thead>
        <tr><th>Title</th><th>Author</th><th>Publisher</th><th>PubDate</th></tr>
       </thead>