Hi. the following code is kinda wonky, so here's the context. I have two 
models:
https://gist.github.com/andrewcw825/f88aa2084e373480f3e63991af7d6c4b

The url_id field is supposed to be an auto increment field; however, since 
it's not the primary key, I can't. Obviously, I could make a function that 
autoincrements for me, but I suppose I simply need this use-case. 

Thus, with the model StuffIDTable, the id is supposed to be the table names 
(i.e. Stuff1 and Stuff2) and the last_number is supposed to be the latest 
number that a url_id used (as in the highest number used by a record of a 
certain table with url_id).

I'm not sure where to go with this. I was thinking of using signals to find 
the latest number used, then update it by incrementing last_number by one, 
then sending another signal back for Stuff1 or Stuff2 to save in url_id. 
Not only that, but what would the signal code look like? How do I even code 
a signal code? 

In the models, do I need a def save(self, *args, **kwargs): 
then some kind of "signals" code provided by Django? Post_save, pre_save? 
Just... confusing...

The previous paragraphs might not have made much sense, so if clarification 
of a certain part (or all of it) is needed, don't hesitate to immediately 
bash on me :)

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b4d09db8-1224-4ef9-adb6-bb4f376eb826%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to