Skip to content

Fix issue #200: Add timestamps to models demo 2 #201

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cld-vasconcelos
Copy link
Collaborator

This pull request fixes #200.

The issue has been successfully resolved based on the following concrete changes and their impact:

  1. The timestamp fields were properly added by modifying the base SoftDeleteModel class, which means all inheriting models automatically receive these fields. This is an efficient implementation approach.

  2. The migration file (0005_collection_created_at_collection_updated_at_and_more.py) shows that the fields were added to all relevant models: Collection, Contest, ContestSubmission, Picture, PictureComment, and User.

  3. The fields are correctly configured as:

    • Nullable (null=True)
    • Auto-populated (auto_now_add=True for created_at, auto_now=True for updated_at)
    • DateTimeField type which is appropriate for timestamps
  4. The included test file (test_timestamps.py) demonstrates that:

    • created_at is set automatically when a record is created
    • updated_at changes when a record is modified
    • created_at remains unchanged after updates
    • Both fields work as expected in actual usage

The changes fully implement the requested functionality and include proper testing to verify the behavior. The implementation is complete and meets all specified requirements without any apparent gaps or issues.

Automatic fix generated by OpenHands 🙌

@cld-vasconcelos
Copy link
Collaborator Author

@openhands-agent in types.py file add the created_at and updated_at fields to all classes that do not have them.

@cld-vasconcelos
Copy link
Collaborator Author

OpenHands started fixing the pr! You can monitor the progress here.

@cld-vasconcelos
Copy link
Collaborator Author

Overview of Changes:

✅ Successfully Implemented:

  • Added created_at/updated_at fields to all required model types
  • Used correct strawberry.auto field type
  • Proper nullable configuration
  • Consistent code formatting
  • Maintained existing functionality

🔍 Verification Points:

  • All model types now have timestamp tracking
  • PictureCommentType properly updated with missing field
  • Mutation response types correctly excluded

📋 Final Status: RESOLVED
All requirements have been met and no outstanding issues remain. The changes provide complete timestamp tracking functionality across all relevant models.

No further actions needed - implementation is complete and meets all specified requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add timestamps to models demo 2
2 participants