Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues using another app's database structure #5

Closed
dgets opened this issue Sep 15, 2018 · 1 comment
Closed

Issues using another app's database structure #5

dgets opened this issue Sep 15, 2018 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dgets
Copy link
Owner

dgets commented Sep 15, 2018

Not sure how to fix this, I'm beyond the tutorial that I was using now... Anyway I'm trying to record the administration of a substance (by its id field), within the 'usage' or 'administration' record that I'm creating. Not quite sure how to get this laid out so Django will be happy with it:

class Usage(models.Model):
    sub = models.ForeignKey(Substance)
    dosage = models.IntegerField()
    timestamp = models.DateTimeField('time administered', default=timezone.now)
    notes = models.CharField(max_length=160)
@dgets dgets added the bug Something isn't working label Sep 15, 2018
@dgets dgets added this to the alpha milestone Sep 15, 2018
@dgets dgets self-assigned this Sep 15, 2018
@dgets
Copy link
Owner Author

dgets commented Sep 15, 2018

The way to do this is 'appname.Tablename', so it would be sub = models.ForeignKey('subadd.Substance') in the previous code snippet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant