Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 117037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:16:22+00:00 2026-05-11T03:16:22+00:00

I have a twenty byte hex hash that I would like to store in

  • 0

I have a twenty byte hex hash that I would like to store in a django model. If I use a text field, it’s interpreted as unicode and it comes back garbled.

Currently I’m encoding it and decoding it, which really clutters up the code, because I have to be able to filter by it.

def get_changeset(self):     return bin(self._changeset)  def set_changeset(self, value):     self._changeset = hex(value)  changeset = property(get_changeset, set_changeset) 

Here’s an example for filtering

Change.objects.get(_changeset=hex(ctx.node())) 

This is the approach that was recommended by a django developer, but I’m really struggling to come to terms with the fact that it’s this ugly to just store twenty bytes.

Maybe I’m too much of a purist, but ideally I would be able to write

Change.objects.get(changeset=ctx.node()) 

The properties allow me to write:

change.changeset = ctx.node() 

So that’s as good as I can ask.

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:16:22+00:00Added an answer on May 11, 2026 at 3:16 am

    I’m assuming if you were writing raw SQL you’d be using a Postgres bytea or a MySQL VARBINARY. There’s a ticket with a patch (marked ‘needs testing’) that purportedly makes a field like this (Ticket 2417: Support for binary type fields (aka: bytea in postgres and VARBINARY in mysql)).

    Otherwise, you could probably try your hand at writing a custom field type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a parent-child that defines some method .foo() like this: class Parent
I have about twenty pages of information that is stored in tables that needs
I have an NSMutableDictionary that possibly contains more than twenty objects. If it contains
I have Clojure function that takes a sequence of numbers chops it into the
I have about twenty UITextViews and corresponding .txt files. What I want is to
I have a web application at work that is similar to a ticket working
Have noticed issue while testing iphone app that if one quickly opens/dismisses a modal
Have you seen library for flexible working with terminal(Unix like)? I want to implement
I have a project that adds elements to an AutoCad drawing. I noticed that
I have a script that appends some rows to a table. One of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.