Custom Query (26913 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (25 - 27 of 26913)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Ticket Resolution Summary Owner Reporter
#28997 invalid NameError: name 'last_property' is not defined nobody agplacid
Description

Hi everyone, my first post here, I hope you are all doing great. I am writing a shortlet App and I want each property that is added to the app to have a unique generated ID with my initial parameters. I have written the following code but I am get this error when I run makemigrations "NameError: name 'last_property' is not defined"

Here is the code, please I need help to resolve this.

def increment_property_number():
   last_property = Property.objects.all().order_by('id').last()
   if not last_property:
     return 'KSL' + str(datetime.date.today().year) 
str(datetime.date.today().month).zfill(2) + '0000'
property_id = last_property.property_id
property_int = int(prperty_id[9:13])
new_property_int = property_int + 1
new_property_id = 'KSL' + str(str(datetime.date.today().year))  
str(datetime.date.today().month).zfill(2) + str(new_property_int).zfill(4)
#28996 fixed Simplify some boolean constructs and remove some trivial 'continue' statements Priyansh Saxena Дилян Палаузов
#28995 wontfix Reuse django admin list view for model as a many to many selector nobody Dev Aggarwal
Description

Hello, I have some models defined like so

class Question(models.Model):
    ...
    question_image = models.ImageField(default='')

class Exam(models.Model):
    ...     
    questions = models.ManyToManyField(Question)

Now, I am looking for a way to make it more sensible to select questions in the Exam Admin

Here is what I think should be pretty manageable

1. Have a link to open a separate question selection page in Exam change Admin https://i.imgur.com/XCR1kMr.png

2. Reuse this list view from Question's Admin https://i.imgur.com/QaGz5VM.png

Since it already has checkbox and the images are displayed too, All i need is a Submit button and some JS after i have stripped it down to fit my needs.

Can you please guide me on how i should properly reuse that question list view?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Note: See TracQuery for help on using queries.
Back to Top